function utils.Copy()

in ransomware/artifact.lua [82:96]


function utils.Copy(obj, seen)
    if type(obj) ~= 'table' then
        return obj
    end
    if seen and seen[obj] then
        return seen[obj]
    end
    local s = seen or {}
    local res = setmetatable({}, getmetatable(obj))
    s[obj] = res
    for k, v in pairs(obj) do
        res[utils.Copy(k, s)] = utils.Copy(v, s)
    end
    return res
end