Module moonwalk.proto
Simple prototypal inheritance.
Functions
| constructor (self) | Constructor function. |
| extend (this, that, meta) | Set this as that's metatable index. |
Functions
- constructor (self)
-
Constructor function.
Override this function as needed. Objects which extend proto can be invoked as functions to create new "instance" objects. This function will be called at that time.
Invoking a proto extension object as a function will return the newly-created instance object, unless constructor returns a truthy value, in which case that value is returned instead. In particular, returning nothing is equivalent to returning
self.Parameters:
- self The newly-created "instance" object.
- extend (this, that, meta)
-
Set
thisasthat's metatable index.Parameters:
- this The object being extended; the parent.
- that The object extending the parent (optional).
- meta Custom meta table (optional).
Returns:
-
The child object (
that).