Class new_class

An instantiatable class to inherit for defining new instantiatable classes classes the "base" class.

To make a new class call leef.class.new(def) or leef.new_class:new_class(def) Also note that these classes will not have the type table but instead class when type(object) is called. This is apart of the LEEF-class module

Functions

leef.class.new_class (def) creates a new class
leef.class.is_class (value) checks if something is a class

Fields

new_class.instance Indicates wether the object is an instance or the base class
new_class.base_class Only present for instances: reference to the class from which this instance originates
new_class.parent_class Reference to the class from which THIS object (or it's base class) was inherited from

Methods

new_class:new_class (self, def) creates a new base class.
new_class:construct (self) Called when an instance is created.
new_class:construct_new_class (self) Called when an instance is created.
new_class:new (def) creates an instance of the base class.
new_class:dump (self, dump_classes) (for printing) dumps the variables of this class


Functions

leef.class.new_class (def)
creates a new class

Parameters:

  • def definition of the class

Returns:

    class
leef.class.is_class (value)
checks if something is a class

Parameters:

  • value value

Returns:

    bool

Fields

new_class.instance
Indicates wether the object is an instance or the base class
  • instance
new_class.base_class
Only present for instances: reference to the class from which this instance originates
  • base_class
new_class.parent_class
Reference to the class from which THIS object (or it's base class) was inherited from
  • parent_class

Methods

new_class:new_class (self, def)
creates a new base class. Calls all constructors in the chain with def.instance=true. Can also be invoked by calling the class.

Parameters:

  • self the table which is being inherited (meaning variables that do not exist in the child, will read as the parent's). Be careful to remember that subtable values are NOT inherited, use the constructor to create subtables.
  • def the table containing the base definition of the class. This should contain a construct

Returns:

    def a new base class
new_class:construct (self)
Called when an instance is created. will be called for any classes which are children or grandchildren (etc) instances, aswell as instances of this class. use this to instantiate arbitrary data like subclasses. if the field "legacyinherit" is present, it will be called for new base classes as well as the initialization of this base class if present.

Parameters:

  • self the table (which would be def from new()).
new_class:construct_new_class (self)
Called when an instance is created. will be called when a new child or grandchild (etc) class is created. useful for instantiation of subtables or any other data.

Parameters:

  • self the table (which would be def from new()).
new_class:new (def)
creates an instance of the base class. Calls all constructors in the chain with def.instance=true

Parameters:

  • def field for the new instance of the class. If fields are not present they will refer to the base class's fields (if present in the base class).

Returns:

    self a new instance of the class.
new_class:dump (self, dump_classes)
(for printing) dumps the variables of this class

Parameters:

  • self
  • dump_classes bool whether to also print/dump classes.

Returns:

    string
generated by LDoc 1.5.0 Last updated 2025-06-22 02:49:31