I already have a abbreviation system and it works, but it goes all funky at 100T. Can someone tell me what is going on? Here is my script(I have it in a module script and reference to it in other scripts): (Also, number is the value i'm working with)
local abbreviatednumber = {}
local abb = {
k = 4,
M = 7,
B = 10,
T = 13,
Qa = 16,
Qn = 19,
Si = 22,
Sp = 25
}
function abbreviatednumber:abb(number)
local text = tostring(math.floor(number))
local chosenabb
for abbreviations, digits in pairs(abb) do
if #text >= digits and #text < (digits + 3) then
chosenabb = abbreviations
break
end
end
if chosenabb then
local digits = abb[chosenabb]
local rounded = math.floor(number / 10 ^ (digits - 2)) * 10 ^ (digits - 2)
text = string.format("%.1f", rounded / 10 ^ (digits - 1))..chosenabb
else
text = number
end
return text
end
return abbreviatednumber
