G.KeyValuesToTable

From GMod Wiki

Jump to: navigation, search
Warning 64 severe.pngThis function is being moved to the util library once the GMod Beta 13 update becomes public



Function
Syntax KeyValuesToTable( String text (key-values) )
Where is this used?
Description:
Returns a table from a key-value string.
Returns: Table
Part of Library: Global Functions
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=G.KeyValuesToTable]G.KeyValuesToTable [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionConverts a key-value string to a table and prints it to the console.
Used onNewerShared.png
Code
local my_string = [["0"
{
	"health"       "123.3"
	"name"         "Billy"
	"extra"
	{
		"param1"    "234"
		"param2"    "Balloon"
		"param3"    "true"
	}
}]]
 
local my_table = KeyValuesToTable( my_string )
 
PrintTable(my_table)
OutputTo Console:
extra:
		param2	=	Balloon
		param1	=	234
		param3	=	true
name	=	Billy
health	=	123.29999542236


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox