Fix stackoverflow caused by new table.copy
This commit is contained in:
parent
367955615e
commit
0e3136f424
|
@ -14,10 +14,18 @@ function table.dump(t, depth)
|
||||||
end
|
end
|
||||||
|
|
||||||
function table.copy(t)
|
function table.copy(t)
|
||||||
|
local res = {}
|
||||||
|
for k,v in pairs(t) do
|
||||||
|
res[k] = v
|
||||||
|
end
|
||||||
|
return res
|
||||||
|
end
|
||||||
|
|
||||||
|
function table.recursivecopy(t)
|
||||||
local res = {}
|
local res = {}
|
||||||
for k,v in pairs(t) do
|
for k,v in pairs(t) do
|
||||||
if type(v) == "table" then
|
if type(v) == "table" then
|
||||||
res[k] = table.copy(v)
|
res[k] = table.recursivecopy(v)
|
||||||
else
|
else
|
||||||
res[k] = v
|
res[k] = v
|
||||||
end
|
end
|
||||||
|
@ -83,4 +91,4 @@ function table.empty(t)
|
||||||
return next(t) == nil
|
return next(t) == nil
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue