| View previous topic :: View next topic |
| Author |
Message |
JetSpike
Joined: 19 Sep 2005 Posts: 8
|
Posted: Tue Jan 17, 2006 10:18 am Post subject: Need Help With Printing Large Numbers |
|
|
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? |
|
| Back to top |
|
 |
JetSpike
Joined: 19 Sep 2005 Posts: 8
|
Posted: Tue Jan 17, 2006 11:32 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
fullerlee
Joined: 03 Nov 2005 Posts: 54
|
Posted: Wed Jan 18, 2006 5:38 am Post subject: |
|
|
You could use:
| Code: | | string.format("%8.0f", x) |
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 |
|
| Back to top |
|
 |
|