Add table.shallowcopy
This commit is contained in:
parent
1d817779df
commit
9282ab4f36
@ -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.
|
||||
--
|
||||
|
Reference in New Issue
Block a user