See also: Classes
class class.new([class baseclass])
Create a new class. If baseclass is given, creates a child of it, and set the 'parent' variable to its base.
This will not call the constructor. That is what the __call operator on the returned class is for: to create an instance of the class.
vector3d class.vector3d([number x, number y, number z])
Create a new table (class) of vector3d. If x, y and z are given, the new vector3d retains the given values.
The vector3d class contains metamethods for operations such as vector scaling and dot product.
See also: Vector3d Class
boolean class.is_a(class baseclass)
Checks if this class is an instance of of child of the given base class. Returns true if so, otherwise false.
-- Dog should be a child of Animal Animal = class.new(); Dog = Animal(); -- Banana should be a child of fruit Fruit = class.new(); Banana = Fruit(); print("Dog is an Animal?", Dog:is_a(Animal)); -- Should be true print("Banana is a Fruit?", Banana:is_a(Fruit)); -- Should be true print("Banana is an Animal?", Banana:is_a(Animal)); -- Should be false