Skip to content

Instantly share code, notes, and snippets.

@cha55son
Created May 12, 2013 02:23
Show Gist options
  • Save cha55son/5562163 to your computer and use it in GitHub Desktop.
Save cha55son/5562163 to your computer and use it in GitHub Desktop.
Simple function that will recursively extend lua tables.
function extend(table1, table2)
for k,v in pairs(table2) do
if (type(table1[k]) == 'table' and type(v) == 'table') then
extend(table1[k], v)
else
table1[k] = v
end
end
end
@lstebner
Copy link

this is pretty old, but if any one else stumbles upon it... the method needs to return table1 and then it seems to work as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment