Module object

The base class for all objects.

Object

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.
_isobject
General identity property for Object This is true for all Objects.

Class Methods

Class Methods. Must be called on Class, with a capital leading character. e.g. Class:method("foo")
Object:new (...)
Create a new instance of Object

Parameters:

  • ... Constructor parameters

Returns:

    Object A new instance of Object
Object:extend (sub)
Create a new class by extending Object

Parameters:

  • 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, self and key.

When instance.foo is accessed, _getters is checked for the field foo. If a function is stored there, it is called, and the return value is passed up. This works via the __index metamethod.

Under the hood, this: instance.foo

Turns 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, and val.

When instance.foo is assigned to, _setters is checked for the field foo. If a function is stored there, it is called, and the return value is passed up. This works via the __newindex metamethod.

Under the hood, this: instance.foo = "bar"

Turns into something like instance._setters.foo(instance, foo, "bar")

generated by LDoc 1.3.12