Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function deepcopy(src, dest, cache, shallow)
- cache = cache or {}
- cache[src] = dest
- for i, v in pairs(src) do
- if type(v) == "table" and not shallow then
- if not cache[v] then
- dest[i] = {}
- deepcopy(v,dest[i],cache)
- else
- dest[i] = cache[v]
- end
- else
- dest[i] = v
- end
- end
- return dest
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement