table.ToString

From Garry's Mod
Jump to: navigation, search
 table.ToString( )

Contents

Description

Converts a table into a string

Arguments

table tbl

The table to iterate over.

Arguments

string displayName

Optional. A name for the table.

Arguments

boolean niceFormatting

Adds new lines and tabs to the string.

Returns

string

The table formatted as a string.

Examples

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",
}
Personal tools
Navigation