Here is what happens:
x = 123456
print(x)
------------
1.2346+e05
Here is what I want:
x = 123456
print(x)
-------------
123456
Can anyone help me achieve this?
Need Help With Printing Large Numbers
Moderators: Shine, Insert_witty_name
Nevermind, I came up with a hack to get the job done, it anyone is interested here is the code I am using:
if intTotalScore >= 100000 then
iScore = tostring(math.floor(intTotalScore/100000)) .. tostring(intTotalScore - (math.floor(intTotalScore/100000))*100000)
fScore:print(300,250,iScore)
else
fScore:print(300,250,intTotalScore)
end
if intTotalScore >= 100000 then
iScore = tostring(math.floor(intTotalScore/100000)) .. tostring(intTotalScore - (math.floor(intTotalScore/100000))*100000)
fScore:print(300,250,iScore)
else
fScore:print(300,250,intTotalScore)
end
You could use:
Where 8 is the number of chars to allocate before the dp and 0 is the number after (i.e. print a whole number).
Lee
Code: Select all
string.format("%8.0f", x)
Lee