Garry's Mod Wiki

table.ToString

  string table.ToString( table tbl, string displayName = nil, boolean niceFormatting = false )

Description

Converts a table into a string

Arguments

1 table tbl
The table to iterate over.
2 string displayName = nil
A name for the table.
3 boolean niceFormatting = false
Adds new lines and tabs to the string.

Returns

1 string
The table formatted as a string.

Example

Demonstrates the use of this function.

local Table = { Red = "Apple", Green = "Celery", Yellow = "Banana"} local String = table.ToString( Table, "Fruit and Vegetable", true ) print( String )
Output:
Fruit and Vegetable = { Red = "Apple", Green = "Celery", Yellow = "Banana", }