mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
.
This commit is contained in:
@@ -39,8 +39,7 @@ local function format_n(amount)
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local scaled_value = amount / scale
|
local formatted = string.format("%.2f", amount / scale)
|
||||||
local formatted = string.format("%.2f", scaled_value)
|
|
||||||
-- Split into integer and fractional parts
|
-- Split into integer and fractional parts
|
||||||
local integer_part, fractional_part = formatted:match("^(%-?%d+)%.(%d+)$")
|
local integer_part, fractional_part = formatted:match("^(%-?%d+)%.(%d+)$")
|
||||||
integer_part = integer_part or formatted
|
integer_part = integer_part or formatted
|
||||||
@@ -50,10 +49,6 @@ local function format_n(amount)
|
|||||||
integer_part = integer_part:gsub("^,", ""):gsub("-,", "-")
|
integer_part = integer_part:gsub("^,", ""):gsub("-,", "-")
|
||||||
-- Handle numbers below 1000 without suffix
|
-- Handle numbers below 1000 without suffix
|
||||||
if scale == 1 then
|
if scale == 1 then
|
||||||
-- Remove trailing .00 for whole numbers
|
|
||||||
if fractional_part == "00" then
|
|
||||||
return integer_part
|
|
||||||
end
|
|
||||||
return string.format("%s.%s", integer_part, fractional_part)
|
return string.format("%s.%s", integer_part, fractional_part)
|
||||||
end
|
end
|
||||||
-- Combine parts and add suffix
|
-- Combine parts and add suffix
|
||||||
|
|||||||
Reference in New Issue
Block a user