Type Function Library table.* Return value String Revision Release 2025.3714 Keywords table, array See also table.insert()
Concatenate the elements of a table together to form a string. Each element must be able to be coerced into a string. A separator can be specified which is placed between concatenated elements.
table.concat ( t ) table.concat ( t, sep ) table.concat ( t, sep, i ) table.concat ( t, sep, i, j ) |
Array. An array where all elements are strings or numbers.
String. The string to insert between concatenated table values. The default value is the empty string.
Number. . The beginning table index to be concatenated. The default value is 1.
Number. . The ending table index to be concatenated. The default value is the length of the array t
. If i is greater than j, returns the empty string.
local t = { 1, 2, "three" , 4, "five" } print ( table.concat (t) ) --> 12three4five print ( table.concat (t, ", " ) ) --> 1, 2, three, 4, five print ( table.concat (t, ", " , 2, 4) ) --> 2, three, 4 |