WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   Stuf HP/MP Format (https://www.wowinterface.com/forums/showthread.php?t=46269)

Kendian 04-13-13 02:08 PM

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~

Clamsoda 04-13-13 02:18 PM

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

Kendian 04-13-13 02:33 PM

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~ :D

Haleth 04-13-13 06:58 PM

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.


All times are GMT -6. The time now is 05:58 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI