table.concat
Turn table into a string, provided that all of its elements can be coerced into a string. If a separator is specified, then it is inserted between each element. Additionally, concatenation starts at the ith element and ends at the jth.
|
|||
Since numbers are coercible to strings, an array of numbers can be concatenated. | |||
Code | <nowiki>
print(table.concat({ 1, 2, 3 }, ', '))
</nowiki>
|
||
Output | 1, 2, 3
|
|
|||
Concatenates an array of both strings and numbers, starting from the 3rd element up to the 5th. | |||
Code | <nowiki>
print(table.concat({ 1, 2, 3, "a", "b", 4, 5 }, ' ', 3, 5))
</nowiki>
|
||
Output | 3 a b
|
table.concat Function | |
---|---|
Syntax table.concat(
| |
Returns | string |
API | table |
Source | Lua (source) |
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.