1 -- Returns the greatest numeric key in a table.
2 function xdecor.maxn(T)
13 -- Returns the length of an hash table.
14 function xdecor.tablelen(T)
24 -- Deep copy of a table. Borrowed from mesecons mod (https://github.com/Jeija/minetest-mod-mesecons).
25 function xdecor.tablecopy(T)
26 if type(T) ~= "table" then
27 return T -- No need to copy.
32 for k, v in pairs(T) do
33 if type(v) == "table" then
34 new[k] = xdecor.tablecopy(v)
43 function xdecor.stairs_valid_def(def)
44 return (def.drawtype == "normal" or def.drawtype:sub(1,5) == "glass") and
45 (def.groups.cracky or def.groups.choppy) and
46 not def.on_construct and
47 not def.after_place_node and
48 not def.on_rightclick and
50 not def.allow_metadata_inventory_take and
51 not (def.groups.not_in_creative_inventory == 1) and
52 not (def.groups.not_cuttable == 1) and
53 not def.groups.wool and
54 (def.tiles and type(def.tiles[1]) == "string" and not
55 def.tiles[1]:find("default_mineral")) and
58 def.description ~= "" and