More actions
No edit summary |
m added option to omit the + symbol from format_value_with_prepost |
||
Line 22: | Line 22: | ||
-- Add prefix and postfix labels to a value. Eg. "32" -> "32s" | -- Add prefix and postfix labels to a value. Eg. "32" -> "32s" | ||
function p.format_value_with_prepost(key, value, frame) | function p.format_value_with_prepost(key, value, frame, exclude_plus) | ||
if (value == nil) then return nil end | if (value == nil) then return nil end | ||
Line 41: | Line 41: | ||
if value < 0 then | if value < 0 then | ||
prefix = '-' | prefix = '-' | ||
else | else | ||
prefix = '+' | prefix = '+' | ||
end | end | ||
Line 49: | Line 49: | ||
prefix = '+' | prefix = '+' | ||
end | end | ||
end | |||
-- some use cases don't require the '+' symbol prefix | |||
if exclude_plus == true and prefix == '+' then | |||
prefix = '' | |||
end | end | ||