Add table.shallowcopy

This commit is contained in:
Tom van Dijck 2016-06-01 18:22:49 -07:00
parent 1d817779df
commit 9282ab4f36

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.
--