function G_uitls:deepcopy(orig)
local orig_type = type(orig)
local copy
if orig_type == 'table' then
copy = {}
for orig_key, orig_value in next, orig, nil do
copy[self:deepcopy(orig_key)] = self:deepcopy(orig_value)
end
setmetatable(copy, self:deepcopy(getmetatable(orig)))
else -- number, string, boolean, etc
copy = orig
end
return copy
end
lua deepcopy
猜你喜欢
转载自my.oschina.net/lyr/blog/1630107
今日推荐
周排行