MTUL-class | implementation of classes and immutable tables in lua (for minetest)

Class new_class

An instantiatable class to inherit for defining new instantiatble classes classes the "base" class. To make a new class call new_class:inherit(your_new_class). also note that these classes will not have the type "table" but "class".

Synopsis

Fields
instance

defines wether the object is an instance, use this in construction to determine what changes to make

base_class

only present for instances: the class from which this instance originates

parent_class

the class from which this class was inherited from

Methods
mtul.class.new_class:inherit()

creates a new base class

mtul.class.new_class:new()

creates an instance of the base class

Fields

new_class.instance

defines wether the object is an instance, use this in construction to determine what changes to make

new_class.base_class

only present for instances: the class from which this instance originates

new_class.parent_class

the class from which this class was inherited from

Methods

mtul.class.new_class:inherit(def)

creates a new base class. Calls all constructors in the chain with def.instance=true

mtul.class.new_class:new(def)

creates an instance of the base class. Calls all constructors in the chain with def.instance=true