#63 use util.strrep where appropriate

This commit is contained in:
Mikayla Fischler 2022-06-08 17:22:20 -04:00
parent d8bbe4b459
commit bc844d21bd
2 changed files with 4 additions and 8 deletions

View File

@ -28,9 +28,7 @@ local function hbar(args)
assert(bar_width > 0, "graphics.elements.hbar: too small for bar")
-- set background blit string
for _ = 1, bar_width do
bkg = bkg .. args.bar_fg_bg.blit_bkg
end
bkg = util.strrep(args.bar_fg_bg.blit_bkg, bar_width)
-- handle data changes
function e.on_update(fraction)

View File

@ -38,11 +38,9 @@ local function rectangle(args)
assert(border_width_h * 2 <= e.frame.h, "graphics.elements.rectangle: border too thick for height")
-- form the basic and top/bottom blit strings
for _ = 1, e.frame.w do
spaces = spaces .. " "
blit_fg = blit_fg .. e.fg_bg.blit_fgd
blit_bg_top_bot = blit_bg_top_bot .. border_blit
end
spaces = util.strrep(" ", e.frame.w)
blit_fg = util.strrep(e.fg_bg.blit_fgd, e.frame.w)
blit_bg_top_bot = util.strrep(border_blit, e.frame.w)
-- form the body blit strings (sides are border, inside is normal)
for x = 1, e.frame.w do