string.rep

string.rep
Function
Syntax
string.rep(
  • str : string
  • repeat : number
)
Colon notation: str:rep(
  • repeat : number
)

Returns string
API string
Source Lua (source)

Return the given str repeated repeat times.

ExampleRepeat user input 3 times
Read a line from the user, then print the the same line repeated 3 times.
Code
<nowiki>
print(string.rep(read(), 3))
    </nowiki>
Output Depends on what the user wrote. For instance, if they were to enter Hello World, the output would be Hello WorldHello WorldHello World.
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.