#300 replaced util.strrep with string.rep

This commit is contained in:
Mikayla Fischler
2023-08-30 19:30:46 -04:00
parent f267a4e569
commit 048714817e
10 changed files with 42 additions and 59 deletions

View File

@@ -76,25 +76,12 @@ function util.strval(val)
end
end
-- repeat a string n times
---@nodiscard
---@param str string
---@param n integer
---@return string
function util.strrep(str, n)
local repeated = ""
for _ = 1, n do repeated = repeated .. str end
return repeated
end
-- repeat a space n times
---@nodiscard
---@param n integer
---@return string
function util.spaces(n)
return util.strrep(" ", n)
return string.rep(" ", n)
end
-- pad text to a minimum width