Thread Tools Display Modes
04-13-13, 02:08 PM   #1
Kendian
A Molten Giant
 
Kendian's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 614
Stuf HP/MP Format

Would there be any way, or could someone point me in the direction to have a shortened number format in Stuf? In example I'd like 135.5k to read as either 135k5 or just plain 135k, rounding up or down, as the case may be.Although, in my opinion, rounding down would be the way to go, lol. Better to think you have less than you do, than more.
I wouldn't mind using a lua script to accomplish this, if possible. Any and all help is, of course greatly appreciated. Thanks, all~
__________________
  Reply With Quote
04-13-13, 02:18 PM   #2
Clamsoda
A Frostmaul Preserver
Join Date: Nov 2011
Posts: 269
Dear Zork,

Thank you.

Love, Clamsoda.

Lua Code:
  1. --number format func
  2.   local numFormat = function(v)
  3.     if v > 1E10 then
  4.       return (floor(v/1E9)).."b"
  5.     elseif v > 1E9 then
  6.       return (floor((v/1E9)*10)/10).."b"
  7.     elseif v > 1E7 then
  8.       return (floor(v/1E6)).."m"
  9.     elseif v > 1E6 then
  10.       return (floor((v/1E6)*10)/10).."m"
  11.     elseif v > 1E4 then
  12.       return (floor(v/1E3)).."k"
  13.     elseif v > 1E3 then
  14.       return (floor((v/1E3)*10)/10).."k"
  15.     else
  16.       return v
  17.     end
  18.   end
  Reply With Quote
04-13-13, 02:33 PM   #3
Kendian
A Molten Giant
 
Kendian's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 614
I would replace the number format in Stuf's text lua, with this? My apologies, I'm not in any way a coder. Let me see what I can break with this. Thanks much~
__________________
  Reply With Quote
04-13-13, 06:58 PM   #4
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
You might also want to try the standard function AbbreviateLargeNumbers(value) instead of using your own. From what I can see it would do exactly what you want it to do.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Stuf HP/MP Format

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off