Module el.object

Define objects with attributes.

Usage:

    local Animal = object()
    

Functions

define (base) Define a new object type.
new (T, ...) Create a new instance of type T.
ref (T, obj, init) Reference some userdata.


Functions

define (base)
Define a new object type. Call when you need to define a custom object. You can also invoke the module directly, which is an alias to define.

Parameters:

  • base

Returns:

    table The new object type table

Usage:

    local object = require ('el.object')
    -- Verbose method
    local Animal = object.define()
    -- Calling the module
    local Cat = object (Animal)
new (T, ...)
Create a new instance of type T.

Parameters:

  • T table The object type to create
  • ... any Arguments passed to T:init

Returns:

    table The newly created object
ref (T, obj, init)
Reference some userdata. Only call this on userdata allocated outside of lua.

Parameters:

  • T table The type of userdata
  • obj userdata Instance allocated in C/C++
  • init boolean Set false to skip calling T.init (default true)

Returns:

    table Proxy object for obj
generated by LDoc 1.5.0 Last updated 2024-02-18 20:31:17