Advertisement
Guest User

Untitled

a guest
Dec 11th, 2015
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. local function ReadableNumber(num, places)
  2. local ret
  3. local placeValue = ("%%.%df"):format(places or 0)
  4. if not num then
  5. return 0
  6. elseif num >= 1000000000000 then
  7. ret = placeValue:format(num / 1000000000000) .. " Tril" -- trillion
  8. elseif num >= 1000000000 then
  9. ret = placeValue:format(num / 1000000000) .. " Bil" -- billion
  10. elseif num >= 1000000 then
  11. ret = placeValue:format(num / 1000000) .. " Mil" -- million
  12. elseif num >= 1000 then
  13. ret = placeValue:format(num / 1000) .. "k" -- thousand
  14. else
  15. ret = num -- hundreds
  16. end
  17. return ret
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement