Difference between revisions of "Tostring"

From GiderosMobile
Line 3: Line 3:
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/(global)|(global)]]<br/>
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/(global)|(global)]]<br/>
 +
 
=== <translate>Description</translate> ===
 
=== <translate>Description</translate> ===
 
<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.  
Line 10: Line 11:
 
(string) = tostring(e)
 
(string) = tostring(e)
 
</source>
 
</source>
 +
 
=== <translate>Parameters</translate> ===
 
=== <translate>Parameters</translate> ===
 
'''e''': (any) <translate>value to convert to string</translate> <br/>
 
'''e''': (any) <translate>value to convert to string</translate> <br/>
 +
 
=== <translate>Return values</translate> ===
 
=== <translate>Return values</translate> ===
 
'''<translate>Returns</translate>''' (string) <translate>value converted to string or nil</translate><br/>
 
'''<translate>Returns</translate>''' (string) <translate>value converted to string or nil</translate><br/>
 +
 +
{{(global)}}

Revision as of 04:30, 11 February 2020


Available since: Gideros 2011.6
Class: (global)

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