Lua error - Custom check conditions aura_env
Zidras opened this issue ยท 5 comments
Describe the bug
Custom check condition with an aura_env give lua error if another condition/state? changes (more info on Additional info). Custom options used to pass aura_env.config.
Troubleshooting also done by fellow member nullKomplex, which was able to reproduce bug.
Do you have an error log of what happened?
Message: [string "--[==[ Error in 'New':'conditions custom ch..."]:2: attempt to index global 'aura_env' (a nil value)
Time: Sun Feb 21 21:28:16 2021
Count: 1
Stack: [string "--[==[ Error in 'New':'conditions custom ch..."]:2: attempt to index global 'aura_env' (a nil value)
[string "--[==[ Error in 'New':'conditions custom check' ]==] return function()
return aura_env.config["OOR"]
end"]:2: in function <[string "--[==[ Error in 'New':'conditions custom ch..."]:1>
[string "=[C]"]: in function `xpcall'
[string "@Interface\AddOns\WeakAuras\Conditions.lua"]:145: in function `CallCustomConditionTest'
[string "--[==[ Error in 'New':'condition checks' ]==] local newActiveConditions = {};
local propertyChanges = {};
local nextTime;
local uid = "7XuluzO(oHE"
return function(region, hideRegion)
local id = region.id
local cloneId = region.cloneId or ''
local state = region.states
local activatedConditions = WeakAuras.GetActiveConditions(id, cloneId)
wipe(newActiveConditions)
local recheckTime;
local now = GetTime();
if (not hideRegion) then
if (state and WeakAuras.CallCustomConditionTest("7XuluzO(oHE", 1, state[1], 1, nil, nil)) then
newActiveConditions[1] = true;
end
if (state and WeakAuras.CallCustomConditionTest("7XuluzO(oHE", 2, state[1], 1, nil, nil)) then
newActiveConditions[2] = true;
end
if (state[1] and state[1].show and state[1]["expirationTime"]~= nil and state[1]["expirationTime"]- now<60) then
newActiveConditions[3] = true;
end
if (state[1] and state[1].show and state[1]["expirationTime"]~= nil and state[1]["expirationTime"]- now<3) then
newActiveConditions[4] = true;
end
if ((state and WeakAuras.CallCustomConditionTest("7XuluzO(oHE", 3, state[2], 1, nil, nil)) and (state and WeakAuras.CallCustomConditionTest("7XuluzO(oHE", 4, state))) then
newActiveConditions[5] = true;
end
end
nextTime = state[1] and state[1]["expirationTime"] and (state[1]["expirationTime"] -60)
if (nextTime and (not recheckTime or nextTime < recheckTime) and nextTime >= now) then
recheckTime = nextTime
end
nextTime = state[1] and state[1]["expirationTime"] and (state[1]["expirationTime"] -3)
if (nextTime and (not recheckTime or nextTime < recheckTime) and nextTime >= now) then
recheckTime = nextTime
end
if (recheckTime) then
WeakAuras.scheduleConditionCheck(recheckTime, uid, cloneId);
end
wipe(propertyChanges)
if (activatedConditions[1] and not newActiveConditions[1]) then
propertyChanges['color'] = {1, 1, 1, 1}
end
if (activatedConditions[2] and not newActiveConditions[2]) then
propertyChanges['color'] = {1, 1, 1, 1}
end
if (activatedConditions[3] and not newActiveConditions[3]) then
propertyChanges['sub.1.text_color'] = {1, 1, 1, 1}
end
if (activatedConditions[4] and not newActiveConditions[4]) then
propertyChanges['sub.1.text_color'] = {1, 1, 1, 1}
end
if (activatedConditions[5] and not newActiveConditions[5]) then
propertyChanges['color'] = {1, 1, 1, 1}
end
if (newActiveConditions[1]) then
if (not activatedConditions[1]) then
propertyChanges['color'] = {0.5, 0.5, 1, 1}
else
if(propertyChanges['color'] ~= nil) then
propertyChanges['color'] = {0.5, 0.5, 1, 1}
end
end
end
activatedConditions[1] = newActiveConditions[1]
if (newActiveConditions[2]) then
if (not activatedConditions[2]) then
propertyChanges['color'] = {0.5, 0.5, 0.5, 1}
else
if(propertyChanges['color'] ~= nil) then
propertyChanges['color'] = {0.5, 0.5, 0.5, 1}
end
end
end
activatedConditions[2] = newActiveConditions[2]
if (newActiveConditions[3]) then
if (not activatedConditions[3]) then
propertyChanges['sub.1.text_color'] = {1, 1, 0, 1}
else
if(propertyChanges['sub.1.text_color'] ~= nil) then
propertyChanges['sub.1.text_color'] = {1, 1, 0, 1}
end
end
end
activ
To Reproduce
Steps to reproduce the behavior:
- (be a paladin just for testing this aura. Change trigger to something else if needed)
- Import test CD progress aura with range checker trigger and several conditions: https://wago.io/qru4lcsy8
- Reload
- Target/detarget mobs
Screenshots
Video clip: https://streamable.com/l41l6d
Did you try having WeakAuras as the only enabled addon and everything else (especially something like ElvUI) disabled?
Yes (however in the clip above I did not sorry, but bug reproducible with WA only enabled)
Which version of WeakAuras are you using?
3.1.9
Are you on World of Warcraft Classic or Retail?
- Classic
- Retail
Was it working in a previous version? If yes, which was the last good one?
No
Additional Info
Here's an even more barebones CD progress aura: https://wago.io/WcVkJWF8o.
- If Custom Check condition is alone, no lua error occurs.
- If I add another condition that checks for something during the aura progress (for example, remaining duration < 3, change text color), lua error occurs.
Step 3 - Reload is crucial to reproduce. If aura imported without reloading, it works as intended, but after reloading, error is 100% reproducible.
Used custom options toggle to pass aura_env.config and attempted to change icon color in conditions, while #1105 is pending
This should be fixed for the next release.
I was able to replicate the issue on this release 3.2.0.
Message: [string "--[==[ Error in 'New':'conditions custom ch..."]:2: attempt to index global 'aura_env' (a nil value)
Time: Tue Mar 9 18:01:30 2021
Count: 1
Stack: [string "--[==[ Error in 'New':'conditions custom ch..."]:2: attempt to index global 'aura_env' (a nil value)
[string "--[==[ Error in 'New':'conditions custom check' ]==] return function()
return aura_env.config["OOR"]
end"]:2: in function <[string "--[==[ Error in 'New':'conditions custom ch..."]:1>
[string "=[C]"]: in function `xpcall'
[string "@Interface\AddOns\WeakAuras\Conditions.lua"]:146: in function `CallCustomConditionTest'
[string "--[==[ Error in 'New':'condition checks' ]==] local newActiveConditions = {};
local propertyChanges = {};
local nextTime;
local uid = "7XuluzO(oHE"
return function(region, hideRegion)
local id = region.id
local cloneId = region.cloneId or ''
local state = region.states
local activatedConditions = WeakAuras.GetActiveConditions(id, cloneId)
wipe(newActiveConditions)
local recheckTime;
local now = GetTime();
if (not hideRegion) then
if (state and WeakAuras.CallCustomConditionTest("7XuluzO(oHE", 1, state[1], 1, nil, nil)) then
newActiveConditions[1] = true;
end
if (state and WeakAuras.CallCustomConditionTest("7XuluzO(oHE", 2, state[1], 1, nil, nil)) then
newActiveConditions[2] = true;
end
if (state[1] and state[1].show and state[1]["expirationTime"]~= nil and state[1]["expirationTime"]- now<60) then
newActiveConditions[3] = true;
end
if (state[1] and state[1].show and state[1]["expirationTime"]~= nil and state[1]["expirationTime"]- now<3) then
newActiveConditions[4] = true;
end
if ((state and WeakAuras.CallCustomConditionTest("7XuluzO(oHE", 3, state[2], 1, nil, nil)) and (state and WeakAuras.CallCustomConditionTest("7XuluzO(oHE", 4, state))) then
newActiveConditions[5] = true;
end
nextTime = state[1] and state[1]["expirationTime"] and (state[1]["expirationTime"] -60)
if (nextTime and (not recheckTime or nextTime < recheckTime) and nextTime >= now) then
recheckTime = nextTime
end
nextTime = state[1] and state[1]["expirationTime"] and (state[1]["expirationTime"] -3)
if (nextTime and (not recheckTime or nextTime < recheckTime) and nextTime >= now) then
recheckTime = nextTime
end
end
if (recheckTime) then
WeakAuras.scheduleConditionCheck(recheckTime, uid, cloneId);
end
wipe(propertyChanges)
if (activatedConditions[1] and not newActiveConditions[1]) then
propertyChanges['color'] = {1, 1, 1, 1}
end
if (activatedConditions[2] and not newActiveConditions[2]) then
propertyChanges['color'] = {1, 1, 1, 1}
end
if (activatedConditions[3] and not newActiveConditions[3]) then
propertyChanges['sub.1.text_color'] = {1, 1, 1, 1}
end
if (activatedConditions[4] and not newActiveConditions[4]) then
propertyChanges['sub.1.text_color'] = {1, 1, 1, 1}
end
if (activatedConditions[5] and not newActiveConditions[5]) then
propertyChanges['color'] = {1, 1, 1, 1}
end
if (newActiveConditions[1]) then
if (not activatedConditions[1]) then
propertyChanges['color'] = {0.5, 0.5, 1, 1}
else
if(propertyChanges['color'] ~= nil) then
propertyChanges['color'] = {0.5, 0.5, 1, 1}
end
end
end
activatedConditions[1] = newActiveConditions[1]
if (newActiveConditions[2]) then
if (not activatedConditions[2]) then
propertyChanges['color'] = {0.5, 0.5, 0.5, 1}
else
if(propertyChanges['color'] ~= nil) then
propertyChanges['color'] = {0.5, 0.5, 0.5, 1}
end
end
end
activatedConditions[2] = newActiveConditions[2]
if (newActiveConditions[3]) then
if (not activatedConditions[3]) then
propertyChanges['sub.1.text_color'] = {1, 1, 0, 1}
else
if(propertyChanges['sub.1.text_color'] ~= nil) then
propertyChanges['sub.1.text_color'] = {1, 1, 0, 1}
end
end
end
activ