Mikk38024@legacy41558003 (talk | contribs) (Use Lua/Libshortcut template. Change category from "LUA Functions" to "Lua functions".) |
({{luaapi}}) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | {{luaapi}} |
||
− | {{:Lua/Libshortcut|strrep|string.rep}} |
||
⚫ | |||
string.rep(s, n) |
string.rep(s, n) |
||
+ | strrep(s, n) |
||
+ | == Examples == |
||
⚫ | |||
− | |||
> = string.rep("Lua ",5) |
> = string.rep("Lua ",5) |
||
Lua Lua Lua Lua Lua |
Lua Lua Lua Lua Lua |
||
Line 10: | Line 11: | ||
Lua |
Lua |
||
Lua |
Lua |
||
+ | > = ("Fire! "):rep(3) -- naturally. |
||
− | |||
+ | Fire! Fire! Fire! |
||
− | {{LUA}} |
Revision as of 22:42, 25 March 2010
Generate a string which is n copies of the string passed concatenated together.
string.rep(s, n) strrep(s, n)
Examples
> = string.rep("Lua ",5) Lua Lua Lua Lua Lua > = string.rep("Lua\n",3) Lua Lua Lua > = ("Fire! "):rep(3) -- naturally. Fire! Fire! Fire!