1. #1
    Bloodsail Admiral
    10+ Year Old Account
    Join Date
    Feb 2012
    Location
    NC
    Posts
    1,011

    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
    Deleted
    Tried removing the ifs and just getting values out?

  3. #3
    Deleted
    value1 would be return 14, not return 15.

  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
  •