1. #1

    Lua error when using WeakAuras for Guard and Stagger

    I have a weakaura for Guard and Stagger to return how much damage I'm staggering or absorbing with guard and I keep getting these errors and not sure how to fix em.

    Guard: [string "retrun function () local name,_,icon,_,_,_,...."]:1: attempt to compare number with nil

    Here's the custom lua I'm using for Guard under display:

    Code:
    function () local name,_,icon,_,_,_,_,_,_,_,_,_,_,_,value=UnitBuff("player", "Guard"); if(value > 999) then value = math.floor(value/1000) .. "k" end; return(value) end
    Stagger: [string "return function() local stagger = select(15..."]:1: attempt to compare number with nil

    Here's the custom lua I'm using for Stagger under display:

    Code:
    function() local stagger = select(15, UnitAura("player", "light stagger", nil, "HARMFUL")) or select(15, UnitAura("player", "moderate stagger", nil, "HARMFUL")) or select(15, UnitAura("player", "heavy stagger", nil, "HARMFUL"));if(stagger > 999) then stagger = math.floor(stagger/1000) .. "k" end;return stagger; end
    Anyone know how to fix these errors?

  2. #2
    Tried removing the ifs and just getting values out?
    Only make passive aggressive posts when it doesn't make you look like a dumbass.

    Flawless - Cats on Ice. Raiding twice a week. Go casual or go home.

  3. #3
    value1 would be return 14, not return 15.
    UI & AddOns expert | Interface & Macros moderator - My work

  4. #4
    Guard:

    Code:
    function () local name,_,icon,_,_,_,_,_,_,_,_,_,_,value=UnitBuff("player", "Guard"); if(value > 999) then value = math.floor(value/1000) .. "k" end; return(value) end
    Stagger:

    Code:
    function() local stagger = select(14, UnitAura("player", "light stagger", nil, "HARMFUL")) or select(14, UnitAura("player", "moderate stagger", nil, "HARMFUL")) or select(14, UnitAura("player", "heavy stagger", nil, "HARMFUL"));if(stagger > 999) then stagger = math.floor(stagger/1000) .. "k" end;return stagger; end

    Essentially, as treeston said, the value1 of UnitAura and UnitBuff is return number 14, not 15 (this is value2).

    Try these.

Posting Permissions

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