Module object
The base class for all objects.
Properties
| _isobject | General identity property for Object
This is true for all Objects. |
Class Methods
| Object:new (...) | Create a new instance of Object |
| Object:extend (sub) | Create a new class by extending Object |
Configuration
| _getters | A table of functions that can be used to intercept read access to fields of an instance. |
| _setters | A table of functions that can be used to intercept write access to fields of an instance. |
Properties
Properties. Significant fields on an instance.Class Methods
Class Methods. Must be called onClass, with a capital leading character.
e.g. Class:method("foo")
- Object:new (...)
-
Create a new instance of
ObjectParameters:
- ... Constructor parameters
Returns:
-
Object
A new instance of
Object - Object:extend (sub)
-
Create a new class by extending
ObjectParameters:
- sub table A table of new properties to extend superclass with
Returns:
-
Object
A new class with the extended properties.
Configuration
Configuration. Required by subclass declarations. Used when instantiating concrete subclasses.- _getters
-
A table of functions that can be used to intercept read access to
fields of an instance.
The functions should take two arguments,
selfandkey.When
instance.foois accessed, _getters is checked for the fieldfoo. If a function is stored there, it is called, and the return value is passed up. This works via the__indexmetamethod.Under the hood, this:
instance.fooTurns into something like
instance._getters.foo(instance, foo) - _setters
-
A table of functions that can be used to intercept write access to
fields of an instance.
The functions should take three arguments,
self,key, andval.When
instance.foois assigned to, _setters is checked for the fieldfoo. If a function is stored there, it is called, and the return value is passed up. This works via the__newindexmetamethod.Under the hood, this:
instance.foo = "bar"Turns into something like
instance._setters.foo(instance, foo, "bar")