Mitko0o1
|
  |
| Joined: 30 Nov 2010 |
| Total Posts: 5725 |
|
|
| 24 Aug 2014 10:05 AM |
| I'm not so good with using the Lua math functions/methods. Can someone explain me how can I make from, for an example, this large number - 1.3809320101490 a little bit smaller one - 1.3809. I know about math.floor but it just rounds the number and it'll make 1. |
|
|
| Report Abuse |
|
|
Mitko0o1
|
  |
| Joined: 30 Nov 2010 |
| Total Posts: 5725 |
|
| |
|
Mitko0o1
|
  |
| Joined: 30 Nov 2010 |
| Total Posts: 5725 |
|
|
| 24 Aug 2014 10:45 AM |
| Is it even possible do be done? Reply please! |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 24 Aug 2014 10:49 AM |
use math.floor on it multiplied by 100 or whatever then divide by 100 or whatever, like this:
x = math.floor(1.234*100)/100 |
|
|
| Report Abuse |
|
|
|
| 24 Aug 2014 10:52 AM |
tonumber(('%.4f'):format(-1.3809320101490))
Where you can change the 4 to how many decimal places you want. |
|
|
| Report Abuse |
|
|
Mitko0o1
|
  |
| Joined: 30 Nov 2010 |
| Total Posts: 5725 |
|
|
| 24 Aug 2014 11:00 AM |
| It works! Thanks guys! This thing was messing with my leaderboard, but not any more. |
|
|
| Report Abuse |
|
|