string.rep

From ComputerCraft
Jump to: navigation, search

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

Returns string
API string
Source Lua (source)

Return the given str repeated repeat times.

ExampleExampleRepeat user input 3 times
Read a line from the user, then print the the same line repeated 3 times.
Code
print(string.rep(read(), 3))
Output Depends on what the user wrote. For instance, if they were to enter Hello World, the output would be Hello WorldHello WorldHello World.