Skip to content
Snippets Groups Projects
Commit 1b54011b authored by Vitaliy's avatar Vitaliy Committed by sfan5
Browse files

Use table.copy in mesecons.tablecopy

mesecons.tablecopy didn’t support recursive tables, while Minetest table.copy works well for them.
parent 15e74362
No related branches found
No related tags found
No related merge requests found
......@@ -186,19 +186,11 @@ function mesecon.invertRule(r)
return vector.multiply(r, -1)
end
function mesecon.tablecopy(table) -- deep table copy
if type(table) ~= "table" then return table end -- no need to copy
local newtable = {}
for idx, item in pairs(table) do
if type(item) == "table" then
newtable[idx] = mesecon.tablecopy(item)
else
newtable[idx] = item
end
function mesecon.tablecopy(obj) -- deep copy
if type(obj) == "table" then
return table.copy(obj)
end
return newtable
return obj
end
function mesecon.cmpAny(t1, t2)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment