local function S(I)local z=type(I)local f if z=="\116\097\098\108\101"then f={}for I,z in next,I,nil do f[S(I)]=S(z)end setmetatable(f,S(getmetatable(I)))else f=I end return f end return S
local function 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[deepcopy(orig_key)] = deepcopy(orig_value)
        end
        setmetatable(copy, deepcopy(getmetatable(orig)))
    else -- number, string, boolean, etc
        copy = orig
    end
    return copy
end

return deepcopy