Garry's Mod Wiki

tostring

  string tostring( any value )

Description

Attempts to convert the value to a string. If the value is an object and its metatable has defined the __tostring metamethod, this will call that function.

print also uses this functionality.

Arguments

1 any value
The object to be converted to a string.

Returns

1 string
The string representation of the value.

Example

Convert a number to a string.

print(tostring(0x16))
Output: 22