Skip to content

Instantly share code, notes, and snippets.

@ryanpcmcquen
Last active November 14, 2021 22:33
Show Gist options
  • Save ryanpcmcquen/7aca8ba7f9bce67d3a375fee72094cf3 to your computer and use it in GitHub Desktop.
Save ryanpcmcquen/7aca8ba7f9bce67d3a375fee72094cf3 to your computer and use it in GitHub Desktop.
Kind of like `Object.assign()` for Lua.
local function combineTables(...)
local combinedTable = {}
local arg = {...}
for k, v in pairs(arg) do
if type(v) == 'table' then
for tk, tv in pairs(v) do
table.insert(combinedTable, tv)
end
end
end
return combinedTable
end
@ryanpcmcquen
Copy link
Author

This does for tables what Object.assign does for objects.

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