Merge pull request #508 from Blizzard/shallow-copy

Add table.shallowcopy
This commit is contained in:
Tom van Dijck 2016-06-10 10:00:59 -07:00 committed by GitHub
commit 1153156e0e

View File

@ -32,6 +32,19 @@
end
--
-- Make a shallow copy of a table
--
function table.shallowcopy(object)
local copy = {}
for k, v in pairs(object) do
copy[k] = v
end
return copy
end
--
-- Make a complete copy of a table, including any child tables it contains.
--