mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-22 14:14:36 +00:00
fixed possible stack overflow in deep_copy
This commit is contained in:
parent
a5c26038df
commit
81512550bb
@ -361,11 +361,11 @@ local function _deep_copy_impl(t, already_copied)
|
|||||||
else
|
else
|
||||||
--a plain table to clone
|
--a plain table to clone
|
||||||
clone = {}
|
clone = {}
|
||||||
|
already_copied[t] = clone
|
||||||
for k, v in pairs(t) do
|
for k, v in pairs(t) do
|
||||||
clone[k] = _deep_copy_impl(v, already_copied)
|
clone[k] = _deep_copy_impl(v, already_copied)
|
||||||
end
|
end
|
||||||
setmetatable(clone, getmetatable(t))
|
setmetatable(clone, getmetatable(t))
|
||||||
already_copied[t] = clone
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return clone
|
return clone
|
||||||
|
Loading…
Reference in New Issue
Block a user