WoW:API tostring: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (New page: Native Lua statement: ;''Arguments'' :'''tostring(arg)''' ::'''arg''' - this value will be converted to a string value. ---- ;''Returns'' :: A string representation of ''arg''. ---- ;'...)
 
m (Move page script moved page API tostring to API tostring without leaving a redirect)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
Native Lua statement:
{{luaapi}}
Returns the string representation of any value.
s = tostring(arg);


;''Arguments''
== Arguments ==
:'''tostring(arg)'''
; arg : Any - Value to convert to a string.
::'''arg''' - this value will be converted to a string value.


----
== Returns ==
;''Returns''
; s : String - string representation of the argument; possibly provided by the argument's metatable.


:: A string representation of ''arg''.
== Examples ==
 
  tostring(123)  --Returns "123"
----
  tostring({})  --Returns "table: ###"
;''Examples''
  tostring(function() end) --Returns "function: ###"
 
  tostring(nil) --Returns "nil"
  tostring(123)
  tostring(true) --Returns "true"
  --Returns "123"
 
  tostring({})
  --Returns "table: ###"
 
  tostring(function() end)
--Returns "function: ###"
 
  tostring(nil)
--Returns "nil"
 
  tostring(true)
--Returns "true"
 
{{LUA}}

Latest revision as of 04:47, 15 August 2023

WoW Lua

Returns the string representation of any value.

s = tostring(arg);

Arguments[edit]

arg
Any - Value to convert to a string.

Returns[edit]

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

Examples[edit]

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