Rename MTUL to LEEF
This commit is contained in:
parent
ac2dff3258
commit
089209b85e
@ -1,2 +1,2 @@
|
||||
# MTUL-class
|
||||
# LEEF-class
|
||||
implements classes and immutable tables (proxy tables.)
|
@ -3,7 +3,7 @@
|
||||
<!-- Documentation generated by LuaDox: https://github.com/jtackaberry/luadox -->
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>new_class - MTUL-class</title>
|
||||
<title>new_class - LEEF-class</title>
|
||||
<link href="../prism.css?7653a2d" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css">
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<body class="class-new_class">
|
||||
<div class="topbar">
|
||||
<div class="group one">
|
||||
<div class="description"><span>MTUL-class | implementation of classes and immutable tables in lua (for minetest)</span></div>
|
||||
<div class="description"><span>LEEF-class | implementation of classes and immutable tables in lua (for minetest)</span></div>
|
||||
</div>
|
||||
<div class="group two">
|
||||
</div>
|
||||
@ -68,12 +68,12 @@ also note that these classes will not have the type "table" but "
|
||||
<div class="heading">Methods</div>
|
||||
<table class="functions ">
|
||||
<tr>
|
||||
<td class="name"><a href="#mtul.class.new_class.inherit"><var>mtul.class.new_class:inherit</var></a>()</td>
|
||||
<td class="name"><a href="#leef.class.new_class.inherit"><var>leef.class.new_class:inherit</var></a>()</td>
|
||||
<td class="doc"><p>creates a new base class</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name"><a href="#mtul.class.new_class.new"><var>mtul.class.new_class:new</var></a>()</td>
|
||||
<td class="name"><a href="#leef.class.new_class.new"><var>leef.class.new_class:new</var></a>()</td>
|
||||
<td class="doc"><p>creates an instance of the base class</p>
|
||||
</td>
|
||||
</tr>
|
||||
@ -108,17 +108,17 @@ also note that these classes will not have the type "table" but "
|
||||
</dl>
|
||||
<h3 class="functions">Methods</h3>
|
||||
<dl class="functions">
|
||||
<dt id="mtul.class.new_class.inherit">
|
||||
<span class="icon"></span><var>mtul.class.new_class:inherit</var>(<em>def</em>)
|
||||
<a class="permalink" href="#mtul.class.new_class.inherit" title="Permalink to this definition">¶</a>
|
||||
<dt id="leef.class.new_class.inherit">
|
||||
<span class="icon"></span><var>leef.class.new_class:inherit</var>(<em>def</em>)
|
||||
<a class="permalink" href="#leef.class.new_class.inherit" title="Permalink to this definition">¶</a>
|
||||
</dt>
|
||||
<dd>
|
||||
<p>creates a new base class. Calls all constructors in the chain with def.instance=true</p>
|
||||
|
||||
</dd>
|
||||
<dt id="mtul.class.new_class.new">
|
||||
<span class="icon"></span><var>mtul.class.new_class:new</var>(<em>def</em>)
|
||||
<a class="permalink" href="#mtul.class.new_class.new" title="Permalink to this definition">¶</a>
|
||||
<dt id="leef.class.new_class.new">
|
||||
<span class="icon"></span><var>leef.class.new_class:new</var>(<em>def</em>)
|
||||
<a class="permalink" href="#leef.class.new_class.new" title="Permalink to this definition">¶</a>
|
||||
</dt>
|
||||
<dd>
|
||||
<p>creates an instance of the base class. Calls all constructors in the chain with def.instance=true</p>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<!-- Documentation generated by LuaDox: https://github.com/jtackaberry/luadox -->
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>Search - MTUL-class</title>
|
||||
<title>Search - LEEF-class</title>
|
||||
<link href="prism.css?7653a2d" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="luadox.css?7653a2d" type="text/css">
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<body class="search-search">
|
||||
<div class="topbar">
|
||||
<div class="group one">
|
||||
<div class="description"><span>MTUL-class | implementation of classes and immutable tables in lua (for minetest)</span></div>
|
||||
<div class="description"><span>LEEF-class | implementation of classes and immutable tables in lua (for minetest)</span></div>
|
||||
</div>
|
||||
<div class="group two">
|
||||
</div>
|
||||
|
@ -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"},
|
||||
];
|
@ -3,7 +3,7 @@
|
||||
<!-- Documentation generated by LuaDox: https://github.com/jtackaberry/luadox -->
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>Search - MTUL-class</title>
|
||||
<title>Search - LEEF-class</title>
|
||||
<link href="prism.css?7653a2d" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="luadox.css?7653a2d" type="text/css">
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<body class="search-search">
|
||||
<div class="topbar">
|
||||
<div class="group one">
|
||||
<div class="description"><span>MTUL-class | implementation of classes and immutable tables in lua (for minetest)</span></div>
|
||||
<div class="description"><span>LEEF-class | implementation of classes and immutable tables in lua (for minetest)</span></div>
|
||||
</div>
|
||||
<div class="group two">
|
||||
</div>
|
||||
|
@ -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.
|
||||
|
8
init.lua
8
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")
|
4
mod.conf
4
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
|
@ -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
|
||||
|
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user