Difference between revisions of "Tostring"
From GiderosMobile
Line 4: | Line 4: | ||
<translate>Receives an argument of any type and converts it to a string in a reasonable format. For complete control of how numbers are converted, use string.format. | <translate>Receives an argument of any type and converts it to a string in a reasonable format. For complete control of how numbers are converted, use string.format. | ||
− | If the [[metatable]] of e has a "__tostring" field, then [[tostring]] calls the corresponding value with e as argument, and uses the result of the call as its result.</translate> | + | If the [[Special:MyLanguage/metatable|metatable]] of e has a "__tostring" field, then [[Special:MyLanguage/tostring|tostring]] calls the corresponding value with e as argument, and uses the result of the call as its result.</translate> |
<source lang="lua"> | <source lang="lua"> | ||
(string) = tostring(e) | (string) = tostring(e) |
Revision as of 16:35, 23 August 2018
Available since: Gideros 2011.6
Description
Receives an argument of any type and converts it to a string in a reasonable format. For complete control of how numbers are converted, use string.format.
If the metatable of e has a "__tostring" field, then tostring calls the corresponding value with e as argument, and uses the result of the call as its result.
(string) = tostring(e)
Parameters
e: (any) value to convert to string
Return values
Returns (string) value converted to string or nil