This commit is contained in:
Baipyrus 2023-10-29 15:10:48 +01:00
parent d8daa2cd46
commit 0d7cb37b5e

View File

@ -6,7 +6,7 @@ end
-- convert number to compact form (1000 => 1k)
function compact_number(number)
local units = {'K', 'M', 'G', 'T'}
local units = {'k', 'M', 'G', 'T'}
local index = 0
-- scale number, increment unit index
@ -16,7 +16,7 @@ function compact_number(number)
end
-- keep 2 decimals, add units
return string.format('%.2f %s', number, units[index] or '')
return string.format('%.2f %s', number, units[index] or ' ')
end
-- format number with energy (/transfer) units
@ -52,7 +52,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)
end
function find_peripheral_component(name)