4,951
edits
Falterfire (talk | contribs) No edit summary |
Falterfire (talk | contribs) (Fixed failed copy+paste) |
||
Line 237: | Line 237: | ||
-- or any other read-only variable | -- or any other read-only variable | ||
-- Stolen from https://gist.github.com/tylerneylon/81333721109155b2d244 | -- Stolen from https://gist.github.com/tylerneylon/81333721109155b2d244 | ||
function p.clone( | function p.clone(obj) | ||
if type(obj) ~= 'table' then return obj end | if type(obj) ~= 'table' then return obj end | ||
local res = {} | local res = {} | ||
for k, v in pairs(obj) do res[clone(k)] = clone(v) end | for k, v in pairs(obj) do res[p.clone(k)] = p.clone(v) end | ||
return res | return res | ||
end | end | ||
return p | return p |