mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
util spaces function
This commit is contained in:
parent
1fa87132d6
commit
dc867095fd
@ -38,7 +38,7 @@ local function rectangle(args)
|
|||||||
assert(border_width_h * 2 <= e.frame.h, "graphics.elements.rectangle: border too thick for height")
|
assert(border_width_h * 2 <= e.frame.h, "graphics.elements.rectangle: border too thick for height")
|
||||||
|
|
||||||
-- form the basic and top/bottom blit strings
|
-- form the basic and top/bottom blit strings
|
||||||
spaces = util.strrep(" ", e.frame.w)
|
spaces = util.spaces(e.frame.w)
|
||||||
blit_fg = util.strrep(e.fg_bg.blit_fgd, 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)
|
blit_bg_top_bot = util.strrep(border_blit, e.frame.w)
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ local function vbar(args)
|
|||||||
-- blit strings
|
-- blit strings
|
||||||
local fgd = util.strrep(e.fg_bg.blit_fgd, e.frame.w)
|
local fgd = util.strrep(e.fg_bg.blit_fgd, e.frame.w)
|
||||||
local bkg = util.strrep(e.fg_bg.blit_bkg, e.frame.w)
|
local bkg = util.strrep(e.fg_bg.blit_bkg, e.frame.w)
|
||||||
local spaces = util.strrep(" ", e.frame.w)
|
local spaces = util.spaces(e.frame.w)
|
||||||
local one_third = util.strrep("\x8f", e.frame.w)
|
local one_third = util.strrep("\x8f", e.frame.w)
|
||||||
local two_thirds = util.strrep("\x83", e.frame.w)
|
local two_thirds = util.strrep("\x83", e.frame.w)
|
||||||
|
|
||||||
|
@ -68,6 +68,13 @@ function util.strrep(str, n)
|
|||||||
return repeated
|
return repeated
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- repeat a space n times
|
||||||
|
---@param n integer
|
||||||
|
---@return string
|
||||||
|
function util.spaces(n)
|
||||||
|
return util.strrep(" ", n)
|
||||||
|
end
|
||||||
|
|
||||||
-- wrap a string into a table of lines, supporting single dash splits
|
-- wrap a string into a table of lines, supporting single dash splits
|
||||||
---@param str string
|
---@param str string
|
||||||
---@param limit integer line limit
|
---@param limit integer line limit
|
||||||
|
Loading…
Reference in New Issue
Block a user