Hello, I am currently making a cookie clicker-like game and if you reach a point where if you get too many cookies you would get a number like 6.28582857373652385623e+14.
I want to make it so that the number doesn’t become like 6.28582857373652385623e+14 and convert it to an actual number like 692,726,385,385,722,555 etc.
Taken from stackoverflow
You can use strings:
local myNumber = 5.9e+192
print(string.format('%18.0f', myNumber)) --> 5900000000000000127345344232885678912507954769917726883775602443469942682202530344963694497685762272422225635880975968134419050330920637473919434093213728536869323861866996282680059554487599104
1 Like
thanks, it kinda sucks that i made a solution but didnt see your post, this was mine by the way
local function convertENumbersToNumbers(enumber)
local decimal = string.split(tostring(enumber), "e+")[1]
local numbersBetweenDot = string.split(decimal, ".")
local nmb = numbersBetweenDot[1]..numbersBetweenDot[2]
return nmb
end
1 Like