fixed possible stack overflow in deep_copy

This commit is contained in:
Max Cahill 2022-06-09 16:36:02 +10:00
parent a5c26038df
commit 81512550bb

View File

@ -361,11 +361,11 @@ local function _deep_copy_impl(t, already_copied)
else
--a plain table to clone
clone = {}
already_copied[t] = clone
for k, v in pairs(t) do
clone[k] = _deep_copy_impl(v, already_copied)
end
setmetatable(clone, getmetatable(t))
already_copied[t] = clone
end
end
return clone