The standard unpack function only operates on one table. The following snippet will unpack elements from any number of tables.
1
2 ---
3 -- Returns all elements from all table arguments
4 function unpacks( ... )
5 local values = {}
6
7 -- Collect values from all tables
8 for i = 1, select( '#', ... ) do
9 for _, value in ipairs( select( i, ... ) ) do
10 values[
11 end
12 end
13
14 return unpack( values )
15 end
16
17 x = {'a', 'b', 'c', 'd', 'e'}
18 y = {'v', 'w', 'x', 'y', 'z'}
19 print( unpacks( x, y ) )
20