Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function ReadableNumber(num, places)
- local ret
- local placeValue = ("%%.%df"):format(places or 0)
- if not num then
- return 0
- elseif num >= 1000000000000 then
- ret = placeValue:format(num / 1000000000000) .. " Tril" -- trillion
- elseif num >= 1000000000 then
- ret = placeValue:format(num / 1000000000) .. " Bil" -- billion
- elseif num >= 1000000 then
- ret = placeValue:format(num / 1000000) .. " Mil" -- million
- elseif num >= 1000 then
- ret = placeValue:format(num / 1000) .. "k" -- thousand
- else
- ret = num -- hundreds
- end
- return ret
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement