1 -- Returns the greatest numeric key in a table.
2 function xdecor.maxn(T)
5 if k > n then n = k end
10 -- Returns the length of an hash table.
11 function xdecor.tablelen(T)
13 for _ in pairs(T) do n = n + 1 end
17 -- Deep copy of a table. Borrowed from mesecons mod (https://github.com/Jeija/minetest-mod-mesecons).
18 function xdecor.tablecopy(T)
19 if type(T) ~= "table" then return T end -- No need to copy.
22 for k, v in pairs(T) do
23 if type(v) == "table" then
24 new[k] = xdecor.tablecopy(v)