Okay, so I have been trying to make a number shortener, and when i test the number shortener with something past the millions like 1.1e15, it returns 110000000M+. What would be the problem here?
code:
local numlength = 0
local stringnumber = ""
local shortenednum = 0
local module = {}
local shorten = 3
local range1 = 3
local range2 = 6
function module:ConvertNumber(number)
if typeof(number) == "number" then
print("Is confirmed to be a number")
numlength = string.len(tostring(number))
local function yes(word)
if number >= 10^range1 and number <= 10^range2 then
--print(range1)
print(number)
stringnumber = string.format("%.2f"..word, number / (10^shorten))
--print(stringnumber)
print(stringnumber)
end
shorten = shorten + 3
range1 = range1 + 3
range2 = range2 + 3
end
--number = tonumber(string.sub(tostring(number),0,3))
yes("M+")
yes("B+")
yes("T+")
yes("QD+")
yes("QN+")
yes("SX+")
yes("SP+")
yes("OCT+")
yes("NON+")
yes("DEC+")
yes("UND+")
yes("DUOD+")
yes("TRED+")
yes("QUATTUROD+")
yes("QUIND+")
yes("SXD+")
yes("SPD+")
yes("OCD+")
yes("NOND+")
yes("VIGN+")
yes("UNVIGN+")
yes("DUOVIGN+")
yes("TREVIGN+")
yes("QUATTUROVIGN+")
yes("QUINVIGN+")
yes("SXVIGN+")
yes("SPVIGN+")
yes("OCTVIGN+")
yes("NONVIGN+")
yes("TRETRIG+")
yes("UNTRETRIG+")
yes("DUOTRETRIG+")
yes("TRETRETRIG+")
yes("QUATTUROTRETRIG+")
yes("QUINTRETRIG+")
yes("SXTRETRIG+")
yes("SPTRETRIG+")
yes("OCTTRETRIG+")
yes("NONTRETRIG+")
yes("QUADRIG+")
yes("UNQUADRIG+")
yes("DUOQUADRIG+")
yes("TREQUADRIG+")
yes("QUATTUROQUADRIG+")
yes("QUINQUADRIG+")
yes("SXQUADRIG+")
yes("SPQUADRIG+")
yes("OCTQUADRIG+")
yes("NONQUADRIG+")
yes("QUINQUAG+")
--number = stringnumber
return stringnumber
else
warn("attempt to get number from another thing that is neither a number nor does it have a number. please make it a number before using this or it will not work")
end
end
return module
any help would be appreciated!