Repeating a string

Basic types / Strings

local str_v = string.rep("7", 3)
-- str_v = 777

-- Any string repeats, not only one char
local laugh = string.rep("ha", 3)
-- laugh = hahaha

-- Zero or negative count: empty, no error
local empty = string.rep("7", -1)
-- empty = ''

-- The 3rd argument goes between the copies
local dashed = string.rep("ab", 3, "-")
-- dashed = ab-ab-ab

print("str_v = " .. str_v)
print("laugh = " .. laugh)
print("empty = '" .. empty .. "'")
print("dashed = " .. dashed)