Implement table.shallowcopy

This commit is contained in:
Lars Mueller 2020-12-01 19:29:18 +01:00
parent 98c702ee28
commit d6774da79f

@ -72,6 +72,14 @@ end
copy = tablecopy copy = tablecopy
function shallowcopy(table)
local copy = {}
for key, value in pairs(table) do
copy[key] = value
end
return copy
end
function deepcopy_noncircular(table) function deepcopy_noncircular(table)
local function _copy(value) local function _copy(value)
if type(value) == "table" then if type(value) == "table" then