diff --git a/README.md b/README.md index b51b2c0..9558107 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# MTUL-class +# LEEF-class implements classes and immutable tables (proxy tables.) \ No newline at end of file diff --git a/docs/class/new_class.html b/docs/class/new_class.html index 3e30e4b..f1a5789 100644 --- a/docs/class/new_class.html +++ b/docs/class/new_class.html @@ -3,7 +3,7 @@ - new_class - MTUL-class + new_class - LEEF-class @@ -11,7 +11,7 @@
-
MTUL-class | implementation of classes and immutable tables in lua (for minetest)
+
LEEF-class | implementation of classes and immutable tables in lua (for minetest)
@@ -68,12 +68,12 @@ also note that these classes will not have the type "table" but "
Methods
- + - + @@ -108,17 +108,17 @@ also note that these classes will not have the type "table" but "

Methods

-
-mtul.class.new_class:inherit(def) - +
+leef.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) - +
+leef.class.new_class:new(def) +

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

diff --git a/docs/index.html b/docs/index.html index aa7ad47..4aebc9d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,7 +3,7 @@ - Search - MTUL-class + Search - LEEF-class @@ -11,7 +11,7 @@
-
MTUL-class | implementation of classes and immutable tables in lua (for minetest)
+
LEEF-class | implementation of classes and immutable tables in lua (for minetest)
diff --git a/docs/index.js b/docs/index.js index 2dc7c4c..f08caa1 100644 --- a/docs/index.js +++ b/docs/index.js @@ -3,6 +3,6 @@ var docs = [ {path:"class/new_class.html#new_class.instance", type:"field", title:"new_class.instance", text:"defines wether the object is an instance, use this in construction to determine what changes to make"}, {path:"class/new_class.html#new_class.base_class", type:"field", title:"new_class.base_class", text:"only present for instances: the class from which this instance originates"}, {path:"class/new_class.html#new_class.parent_class", type:"field", title:"new_class.parent_class", text:"the class from which this class was inherited from"}, -{path:"class/new_class.html#mtul.class.new_class.inherit", type:"function", title:"mtul.class.new_class:inherit", text:"creates a new base class. Calls all constructors in the chain with def.instance=true"}, -{path:"class/new_class.html#mtul.class.new_class.new", type:"function", title:"mtul.class.new_class:new", text:"creates an instance of the base class. Calls all constructors in the chain with def.instance=true"}, +{path:"class/new_class.html#leef.class.new_class.inherit", type:"function", title:"leef.class.new_class:inherit", text:"creates a new base class. Calls all constructors in the chain with def.instance=true"}, +{path:"class/new_class.html#leef.class.new_class.new", type:"function", title:"leef.class.new_class:new", text:"creates an instance of the base class. Calls all constructors in the chain with def.instance=true"}, ]; \ No newline at end of file diff --git a/docs/search.html b/docs/search.html index da0890b..9d076a1 100644 --- a/docs/search.html +++ b/docs/search.html @@ -3,7 +3,7 @@ - Search - MTUL-class + Search - LEEF-class @@ -11,7 +11,7 @@
-
MTUL-class | implementation of classes and immutable tables in lua (for minetest)
+
LEEF-class | implementation of classes and immutable tables in lua (for minetest)
diff --git a/generate_docs/luadox/luadox.conf b/generate_docs/luadox/luadox.conf index 74b6073..2824fff 100644 --- a/generate_docs/luadox/luadox.conf +++ b/generate_docs/luadox/luadox.conf @@ -1,8 +1,8 @@ [project] # Project name that is displayed on the top bar of each page -name = MTUL-class | implementation of classes and immutable tables in lua (for minetest) +name = LEEF-class | implementation of classes and immutable tables in lua (for minetest) # HTML title that is appended to every page. If not defined, name is used. -title = MTUL-class +title = LEEF-class # A list of files or directories for LuaDox to parse. Globs are supported. # This can be spread across multiple lines if you want, as long as the # other lines are indented. diff --git a/init.lua b/init.lua index 648d2d4..d80658f 100644 --- a/init.lua +++ b/init.lua @@ -1,8 +1,8 @@ -if not mtul then - mtul = {} +if not leef then + leef = {} end -mtul.class = {} +leef.class = {} -local path = minetest.get_modpath("mtul_class") +local path = minetest.get_modpath("leef_class") dofile(path.."/proxy_table.lua") dofile(path.."/new_class.lua") \ No newline at end of file diff --git a/mod.conf b/mod.conf index 6d2cac1..8a0d3ed 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,4 @@ -name = mtul_class -title = MTUL class lib +name = leef_class +title = LEEF class lib description = Simple class system for minetest, with a inbuilt read only table system author = FatalError42O \ No newline at end of file diff --git a/new_class.lua b/new_class.lua index ecd4494..7fc02b7 100644 --- a/new_class.lua +++ b/new_class.lua @@ -7,7 +7,7 @@ local objects = {} setmetatable(objects, { __mode = 'kv' --allow garbage collection. }) -mtul.class.new_class = { +leef.class.new_class = { instance = false, --__no_copy = true } @@ -21,7 +21,7 @@ mtul.class.new_class = { -- @param def the table containing a new definition (where the class calling the method is the parent). The content of the definition will override the fields for it's children. -- @return def a new base class -- @function Guns4d.Instantiatable_class:inherit() -function mtul.class.new_class:inherit(def) +function leef.class.new_class:inherit(def) objects[def] = true --construction chain for inheritance --if not def then def = {} else def = table.shallow_copy(def) end @@ -52,7 +52,7 @@ end --- creates an instance of the base class. Calls all constructors in the chain with def.instance=true -- @return def a new instance of the class. -- @function Guns4d.Instantiatable_class:new(def) -function mtul.class.new_class:new(def) +function leef.class.new_class:new(def) --if not def then def = {} else def = table.shallow_copy(def) end def.base_class = self def.instance = true @@ -65,7 +65,7 @@ function mtul.class.new_class:new(def) self.construct(def) return def end -function mtul.class.new_class:dump(dump_classes) +function leef.class.new_class:dump(dump_classes) local str = "{" for i, v in pairs(self) do if type(i) == "string" then diff --git a/proxy_table.lua b/proxy_table.lua index d88096e..ee08ca6 100644 --- a/proxy_table.lua +++ b/proxy_table.lua @@ -8,7 +8,7 @@ local Proxy_table = { --setmetatable(Proxy_table.tables_by_proxies, {__mode="v"}) --setmetatable(Proxy_table.proxy_children, {__mode="k"}) -mtul.class.proxy_table = Proxy_table +leef.class.proxy_table = Proxy_table --this creates proxy tables in a structure of tables --this is great if you want to prevent the change of a table --but still want it to be viewable, such as with constants @@ -24,7 +24,7 @@ local metatable = { end end, __newindex = function(table, key) - assert(false, "attempt to edit immutable table, cannot edit a proxy table (MTUL-class)") + assert(false, "attempt to edit immutable table, cannot edit a proxy table (LEEF-class)") end, __len = function(t) print("test")
mtul.class.new_class:inherit()leef.class.new_class:inherit()

creates a new base class

mtul.class.new_class:new()leef.class.new_class:new()

creates an instance of the base class