This commit is contained in:
Baipyrus 2023-11-03 20:43:16 +01:00
parent 484c42c4a4
commit 1dd54d4afb

View File

@ -55,7 +55,7 @@ function format_percent(options, number, mult)
percent = number * 100
end
return string.format('%.2f ', percent) .. '% ' .. string.rep(' ', #options.unit)
return string.format('%.2f ', percent) .. '% ' .. string.rep(' ', #(options.unit or ''))
end
-- format temperature as number with two decimals and padded unit
@ -67,7 +67,7 @@ function format_temp(options, number)
else temperature = string.format('%.2f ', temperature) end
-- build string
return temperature .. 'K ' .. string.rep(' ', #options.unit)
return temperature .. 'K ' .. string.rep(' ', #(options.unit or ''))
end
-- format liquids as compact number and padded unit