function table.DeepCopy(tab)
if tab== nil then
return nil
end
local copy = {}
for k, v in pairs(tab) do
if type(v) == 'table' then
copy[k] = table.deepCopy(v)
else
copy[k] = v
end
end
setmetatable(copy, table.deepCopy(getmetatable(tab)))
return copy
end
网友评论