Difference between revisions of "Tostring"

From ComputerCraft Wiki
Jump to: navigation, search
(Un-stub'ed document (w/h templates & examples!).)
m (removing API link)
Line 4: Line 4:
 
|args=Object o
 
|args=Object o
 
|returns=[[string (type)|string]] representation of the Object <var>o</var>
 
|returns=[[string (type)|string]] representation of the Object <var>o</var>
|api=none
+
|api=
 
|addon=Lua
 
|addon=Lua
 
|desc=Converts any passed object to it's string-representation.
 
|desc=Converts any passed object to it's string-representation.

Revision as of 10:06, 30 November 2012


Grid Redstone.png  Function tostring
Converts any passed object to it's string-representation.
Syntax tostring(Object o)
Returns string representation of the Object o
Part of Lua
API none

Examples

Grid paper.png  Example
Convert an integer to a string
Code
local a = tostring(1)
Output a = "1" (string)



Grid paper.png  Example
Convert a float to a string
Code
local b = tostring(3.1415)
Output b = "3.1415" (string)