|
| 10 Jul 2015 10:57 PM |
| Is it possible to get the numbers over 1k, 10k, 100k, 1M, and so on to have decimals and be coded more efficient instead of 'if value > 1000 then text = "1k"'. Also having decimals as in 1.1k and 101k? |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Jul 2015 11:19 PM |
| Pretty sure there's an article on the wiki about it |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2015 11:19 PM |
| Link please? I'm willing to read through it. |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2015 11:21 PM |
http://wiki.roblox.com/index.php?title=Math
that's the part about math
but just look around
I know there's a way I saw someone do it |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 12:22 AM |
Wrote this for you, it should work. Returns a string that formats the number.
http://codepad.org/575Tq82e
~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~ |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 12:24 AM |
Add a break at the end (but inside of) that for loop, for better efficiency.
So it should be
if num >= 1000*i then num = num / 1000 suffix = suffixes[i] break end
~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~ |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 12:27 AM |
Hold on that's wrong let me fix it.
~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~ |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 12:31 AM |
My bad, fixed: http://codepad.org/yUQHewcS
~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~ |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 12:32 AM |
Fourth times the charm: http://codepad.org/jZJFdCAC
~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~ |
|
|
| Report Abuse |
|
|