Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --initScript()-----------------------------------
- -- Put your Lua functions here. --
- -- --
- -- Note that you can also use external Scripts --
- -------------------------------------------------
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement