Last active
November 9, 2018 19:24
-
-
Save JlnWntr/cc08a28d3ce9135d86b4639881d7534e to your computer and use it in GitHub Desktop.
Simplest Lua table deep copy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fullcopy(a, b) | |
for k, v in pairs(a) do | |
if type(v)=="table" then | |
b[k] = {} | |
fullcopy(v, b[k]) | |
else | |
b[k] = v | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment