This commit is contained in:
Baipyrus 2023-10-31 15:14:46 +01:00
parent d4fbdca039
commit c8550dc38f

View File

@ -21,11 +21,13 @@ end
-- format number with energy (/transfer) units
function format_energy(options, number, transfer)
local energy = tostring(number)
local energy = number
-- compact number
if options.compact then
energy = compact_number(number)
else
energy = energy .. ' '
end
-- append transfer unit
@ -46,7 +48,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)
end
-- format temperature as number with two decimals and padded unit
@ -55,7 +57,7 @@ function format_temp(options, number)
-- compact number
if options.compact then temperature = compact_number(number)
else temperature = string.format('%.2f ', temperature) end
else temperature = string.format('%.2f ', temperature) end
-- build string
return temperature .. 'K ' .. string.rep(' ', #options.unit)
@ -69,7 +71,7 @@ function format_liquid(options, number, transfer)
if options.compact then
liquid = compact_number(number)
else
liquid = liquid .. ' '
liquid = liquid .. ' '
end
-- append transfer unit