string.reverse

From ComputerCraft
Jump to: navigation, search

string.reverse
Function
Syntax
string.reverse()
Colon notation: str:reverse()

Returns string
API string
Source Lua (source)

Return the given str with the character order reversed.

ExampleExamplePrint the reverse of user input
Read a line from the user, then print the same input reversed.
Code
print(string.reverse(read()))
Output Depends on what the user wrote. For instance, if they were to enter Hello World, the output would be dlroW olleH.