Fixed calc overview of sources of increases/reductions not being formatted

This commit is contained in:
Left
2021-02-17 09:32:49 +11:00
parent f57eba99bd
commit 09f44cb8db
2 changed files with 12 additions and 1 deletions

View File

@@ -350,7 +350,7 @@ function CalcBreakdownClass:AddModSection(sectionData, modList)
for _, row in ipairs(rowList) do
if not sectionData.modType then
-- No modifier type specified, so format the value to convey type
row.displayValue = self:FormatModValue(row.value, row.mod.type)
row.displayValue = formatInteger(self:FormatModValue(row.value, row.mod.type))
else
section.colList[1].right = true
row.displayValue = formatRound(row.value, 2)

View File

@@ -494,6 +494,17 @@ function formatNumSep(str)
end)
end
-- Takes either string representation of an integer or an integer and returns a formatted string
-- "123456789" -> "1,234,567,890"
function formatInteger(int)
local str = tostring(int)
if main.showThousandsSeparators then
return str:gsub("(%d)(%d%d)","%1"..main.thousandsSeparator.."%2")
else
return str
end
end
function getFormatNumSep(dec)
return function(val)
return formatNumSep(val, dec)