Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local abbr = function(num)
- local n = string.len(floor(num))
- local l = n <= 3 and '' or n <= 6 and 'K' or n <= 9 and 'M' or n <= 12 and 'B' or n <= 15 and 'T' or 'Q'
- num = string.format("%.1f",num/10^(math.floor((n-1)/3)*3))
- local p = string.find(num,"%.") or 1
- p = n <= 3 and p-1 or p == 2 and 4 or p == 3 and 4 or 3
- return string.sub(num,0,p) .. l
- end
Advertisement
Add Comment
Please, Sign In to add comment