Lua error - state (a nil value)
Zidras opened this issue ยท 7 comments
Describe the bug
Was testing out the new release and with the WA options open, suddenly got this error. Not really sure on how to replicate it, will do more testing and edit the bug report
Do you have an error log of what happened?
Message: [string "--[==[ Error in 'New':'condition checks' ]=..."]:22: attempt to index local 'state' (a nil value)
Time: Tue Mar 9 18:10:00 2021
Count: 4
Stack: [string "--[==[ Error in 'New':'condition checks' ]=..."]:22: attempt to index local 'state' (a nil value)
[string "=[C]"]: ?
[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[1], 0, 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
activatedConditions[3] = newActiveConditions[3]
if (newActiveConditions[4]) then
if (not activatedConditions[4]) then
propertyChanges['sub.1.text_color'] = {1, 0, 0, 1}
else
if(propertyChanges['sub.1.text_color'] ~= nil) then
propertyChanges['sub.1.text_color'] = {1, 0, 0, 1}
end
end
To Reproduce
Steps to reproduce the behavior:
(TBD)
Screenshots
Did you try having WeakAuras as the only enabled addon and everything else (especially something like ElvUI) disabled?
Had only stock elvui running, will do more testing with only WA.
Which version of WeakAuras are you using?
3.2.0
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?
Yes
Additional Info
IS that the same error as: #2949 ?
I don't think it is related. Lua error is different. Also didn't happen before this release
Previous report was due to an aura_env bug with custom check conditions. Present in previous release.
This state nil error is being triggered with WA options open (don't know exact steps to reproduce yet, trying to get it to bug again) - not present in previous release.
Aura was the same so it might look similar, maybe that's the confusion?
I still don't know the steps to error it, but this is a clip I just managed to get: "looping" through the error:
https://streamable.com/5ihaw1
Not much to go on yet, sorry Infus