util pad function

This commit is contained in:
Mikayla Fischler
2022-08-16 11:22:06 -04:00
parent 3c2f631451
commit 7f011369c4
3 changed files with 15 additions and 10 deletions

View File

@@ -45,11 +45,7 @@ local function state_indicator(args)
args.width = string.len(state_def.text)
end
local len = string.len(state_def.text)
local lpad = math.floor((args.width - len) / 2)
local rpad = args.width - lpad
local text = util.spaces(lpad) .. state_def.text .. util.spaces(rpad)
local text = util.pad(state_def.text, args.width)
table.insert(state_blit_cmds, {
text = text,