API tostring

From Warcraft Wiki
Jump to navigation Jump to search

Returns the string representation of any value.

s = tostring(arg);

Arguments

arg
Any - Value to convert to a string.

Returns

s
string - string representation of the argument; possibly provided by the argument's metatable.

Example

tostring(123)  --Returns "123"
tostring({})  --Returns "table: ###"
tostring(function() end) --Returns "function: ###"
tostring(nil) --Returns "nil"
tostring(true) --Returns "true"