table.concat

From GMod Wiki

Jump to: navigation, search
Function
Syntax table.concat( Table table, [ String separator, Number start location, Number end location] )
Where is this used?
Description:
Concatenates the contents of a table with a separator.
Returns: String Concatenated string
Part of Library: Table
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Table.concat]Table.concat [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionConcatenate test_table in a few different ways.
Used onNewerShared.png
Code
 
test_table = {"This","is","a","table","concat","test!"} // Make the table.
print(table.concat(test_table)) // Prints "Thisisatableconcattest!" to the console.
print(table.concat(test_table," ")) // Prints "This is a table concat test!"
print(table.concat(test_table," ",2,5)) // Prints "is a table concat"
print(table.concat(test_table," ",1,2)) // Prints "This is"
print(table.concat(test_table," ",3,4)) // Prints "a table"
print(table.concat(test_table," ",5,6)) // Prints "concat test!"
 
OutputPrints several strings to the console.


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox