tostring

From ComputerCraft
Jump to: navigation, search

tostring
Function
Syntax
tostring(
  • x : any The value to convert to a string.
)

Returns string
API Base globals
Source Lua (source)

Converts x to a string.

Note Note: If used on a table, this function will return table: address where address is the memory address of the table. To turn the actual table contents into a string, use textutils.serialise.

Note Note: You can also use x.."".

ExampleExampleConvert a number to a string.
Takes the number 64, converts it to a string and then prints it.
Code
local stringFromNumber = tostring(64)
print(stringFromNumber)
Output
64