Skip to content

Commit 1f27833

Browse files
author
LocalIdentity
committed
Fix 0 trimming for stat diff display
1 parent b7933fc commit 1f27833

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Modules/Build.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,6 @@ function buildMode:FormatStat(statData, statVal, overCapStatVal, colorOverride)
15391539
if number then
15401540
valStr = number:gsub("0+$", ""):gsub("%.$", "") .. suffix
15411541
end
1542-
valStr:gsub("%.", main.decimalSeparator)
15431542
valStr = color .. formatNumSep(valStr)
15441543

15451544
if overCapStatVal and overCapStatVal > 0 then
@@ -1741,6 +1740,10 @@ function buildMode:CompareStatList(tooltip, statList, actor, baseOutput, compare
17411740
local color = ((statData.lowerIsBetter and diff < 0) or (not statData.lowerIsBetter and diff > 0)) and colorCodes.POSITIVE or colorCodes.NEGATIVE
17421741
local val = diff * ((statData.pc or statData.mod) and 100 or 1)
17431742
local valStr = s_format("%+"..statData.fmt, val) -- Can't use self:FormatStat, because it doesn't have %+. Adding that would have complicated a simple function
1743+
local number, suffix = valStr:match("^([%+%-]?%d+%.%d+)(%D*)$")
1744+
if number then
1745+
valStr = number:gsub("0+$", ""):gsub("%.$", "") .. suffix
1746+
end
17441747

17451748
valStr = formatNumSep(valStr)
17461749

0 commit comments

Comments
 (0)