Quantcast
WoWInterface - View Single Post - code integration
View Single Post
09-25-17, 06:19 PM   #11
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,292
Maybe I'm misunderstanding but:
Lua Code:
  1. local function ReadableNumber(num)
  2.         local ret
  3.         local placeValue = ("%%.%df"):format(2) --probably can be improved into "%.0f"
  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
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote