SYNOPSIS
dst = table.combine(src[, src[, ...]])
DESCRIPTION
Combines the contents of all src tables into one table.
The operation proceeds through the arguments from left to right, later keys overwriting earlier keys of the same value.
Nested tables are combined recursively with deep copy. The resulting table will have no references to any source tables.
The operation proceeds through the arguments from left to right, later keys overwriting earlier keys of the same value.
Nested tables are combined recursively with deep copy. The resulting table will have no references to any source tables.
EXAMPLE
>
>
>
>
a = { x = 5 }
b = { y = 7 }
c = table.combine(a, b)
for k,v in pairs(c) do print(k,v) end
y 7
x 5
NOTES
If you want to do dst = table.combine(dst, src), you might want to prefer table.merge which does this more efficiently.
To get a deep copy of a table, simply use table.combine() with a single argument.