WeakAuras

WeakAuras

206M Downloads

display Custom code seems not to use IF

Breakerzeus opened this issue ยท 1 comments

commented

Describe the bug

My WA for buff food use some simple calculation code to determine how long it takes to get the food buff. it worked well until patch 8.3 and WA version 2.16.

it uses this function in display:

function()    
    if aura_env.states[3] then        
        local expTime = aura_env.states[3].expirationTime-GetTime()
        return string.format("%.f",expTime-9.5)
    end
end

It seems that WA is ignoring the aura_env_states[3] and is executing the code after that although aura_env.states[3] does not exist (this trigger is the buff you get when you eat the food).
As the error log states, WA tries to calculate the value 'expirationTime' but it does not exists since the buff while fooding is not there.

Do you have an error log of what happened?

54x [string "--[==[ Error in 'Food Missing':'custom text..."]:3: attempt to perform arithmetic on field 'expirationTime' (a nil value)
[string "=[C]"]: in function `xpcall'
[string "@WeakAuras\WeakAuras-2.16.0.lua"]:6003: in function `RunCustomTextFunc'
[string "@WeakAuras\SubRegionTypes\SubText.lua"]:239: in function `?'
[string "@WeakAuras\RegionTypes\RegionPrototype.lua"]:33: in function `Notify'
[string "@WeakAuras\WeakAuras-2.16.0.lua"]:5781: in function <WeakAuras\WeakAuras.lua:5778>
[string "@WeakAuras\WeakAuras-2.16.0.lua"]:5864: in function <WeakAuras\WeakAuras.lua:5831>
[string "@WeakAuras\WeakAuras-2.16.0.lua"]:5948: in function `UpdatedTriggerState'
[string "@WeakAuras\BuffTrigger2.lua"]:1252: in function <WeakAuras\BuffTrigger2.lua:1244>
[string "@WeakAuras\BuffTrigger2.lua"]:1543: in function <WeakAuras\BuffTrigger2.lua:1536>

To Reproduce

Steps to reproduce the behavior:

  1. Go into raid with group or change to WA to load without grp
  2. cancel your food buff if you already got one
  3. see the lua errors rollin'

Screenshots

Did you try having WeakAuras as the only enabled addon and everything else (especially something like ElvUI) disabled?

no
Which version of WeakAuras are you using?
2.16.0

Are you on World of Warcraft Classic or Retail?

  • Classic
  • [ x] Retail

Was it working in a previous version? If yes, which was the last good one?
2.15.5

Additional Info

WA via Wago.io for testing purposes: https://wago.io/N7O7mFFEU

  ERROR HERE
commented

The error message is quite clear, the state exists, but expiratiomTime is nil. You need to check if expirationTime exists, not if the state exists.