A mixin can also be viewed as an interface with implemented methods.
Object(from, [mixin...])
Declare a new Object type using the from prototype.
The Object() function implements multilevel single inheritance object oriented programming for Lua.
Parameters
from
A table or an other previously declared object that serves as a prototype to define a new custom type.
[mixin...]
One or more optional tables that contains methods, to extend the object capabilities.
Return value
Returns the new defined object type.Example
Polygon = Object {
sides = 0
}
-- outputs "Object"
print(type(Polygon))