Difference between revisions of "Tostring"
From ComputerCraft Wiki
m (removing API link) |
(Changing int to number) |
||
| (One intermediate revision by one other user not shown) | |||
| Line 3: | Line 3: | ||
|name=tostring | |name=tostring | ||
|args=Object o | |args=Object o | ||
| − | |returns= | + | |returns={{type|string}} representation of the Object <var>o</var> |
|api= | |api= | ||
| − | |addon= | + | |addon=ComputerCraft |
|desc=Converts any passed object to it's string-representation. | |desc=Converts any passed object to it's string-representation. | ||
|examples= | |examples= | ||
{{Example | {{Example | ||
| − | |desc=Convert an | + | |desc=Convert an {{type|number}} to a {{type|string}} |
|code=local a = tostring(1) | |code=local a = tostring(1) | ||
| − | |output= a = "1" ( | + | |output= a = "1" ({{type|string}}) |
}} | }} | ||
{{Example | {{Example | ||
| − | |desc=Convert a | + | |desc=Convert a {{type|number}} to a {{type|string}} |
|code=local b = tostring(3.1415) | |code=local b = tostring(3.1415) | ||
| − | |output= b = "3.1415" ( | + | |output= b = "3.1415" ({{type|string}}) |
}} | }} | ||
}} | }} | ||
Latest revision as of 12:54, 18 July 2013
| Converts any passed object to it's string-representation. | |
| Syntax | tostring(Object o) |
| Returns | string representation of the Object o |
| Part of | ComputerCraft |
| API | none |
Examples
| Convert an number to a string | |
| Code |
local a = tostring(1) |
| Output | a = "1" (string) |
| Convert a number to a string | |
| Code |
local b = tostring(3.1415) |
| Output | b = "3.1415" (string) |