1. #1

    Weakauras Percentage display, getting rid of decimals.

    So what I'm trying to do with my very limited lua knowledge is a simple % mana text aura such as this:
    function()  local p = math.max(1, UnitPower("Player")) / math.max(1, UnitPowerMax("Player")) * 100; return p
    Which is all dandy and working, however I can't seem to stop it from returning decimals. Had it been one or two I'd be fine, but having 91.666666666666667% mana shown across your screen gets hard to read!

    Any suggestions?

  2. #2
    You can use floor() or ceil() which will round down or up to the nearest integer respectively. You can also write your own function to round to the nearest integer.

    function roundNumber(number)
    	if ( number >= 0 ) then
    		return floor(number + 0.5);
    		return ceil(number - 0.5);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts