string.char

From ComputerCraft
Jump to: navigation, search

string.char
Function
Syntax
string.char()
Returns string
API string
Source Lua (source)

Creates a string containing only the byte num. Hence, the number passed must be at least 0 and at most 255, and will be floored to the nearest integer.

ExampleExamplePrint the decoded character of the byte entered in the user's input
Read a line from the user, then prints the character that the entered codepoint represents.
Code
print(string.char(tonumber(read()))
Output Depends on what the user wrote. For instance, if they were to enter 65, the character printed would be A.