Originally Posted by myrroddin
[string "@RepByZone\Core-Retail.lua"]:329: in function `CheckSholazarBasin'
[string "@RepByZone\Data-Retail.lua"]:13: in function `ZoneAndFactionList'
[string "@RepByZone\Core-Retail.lua"]:450: in function `SwitchedZones'
|
|
From these 3 lines repeating near the top of the stack, this indicates an infinite loop.
This is triggered both from
RepByZone:OnEnable() calling
RepByZone:ZoneAndFactionList() and your events calling
RepByZone:SwitchedZones().
Originally Posted by myrroddin
However, if I remove those lines in SwitchedZones(), I get the error below, which didn't exist until two days ago. Again, this doesn't make sense to me, since the tables are not nil.
|
The variable in question is indeed
nil, but to explain, we'll walk through the call stack.
[string "=[C]"]: in function `pairs'
[string "@RepByZone\Core-Retail.lua"]:452: in function `SwitchedZones'
[string "@RepByZone\Core-Retail.lua"]:329: in function `CheckSholazarBasin'
[string "@RepByZone\Data-Retail.lua"]:13: in function `ZoneAndFactionList'
[string "@RepByZone\Core-Retail.lua"]:152: in function <RepByZone\Core-Retail.lua:140>
|
The first entry points to this line in
RepByZone:OnEnable().
Code:
zonesAndFactions = self:ZoneAndFactionList()
The error occurs while running
RepByZone:ZoneAndFactionList() so the variable (and others following it) doesn't actually get set.
This continues on to
RepByZone:CheckSholazarBasin(), which proceeds with calling
RepByZone:SwitchedZones(). Note this function hasn't returned yet either and continues holding up the line.
Now
RepByZone:SwitchedZones() is running, but because neither of the functions have had the ability to return yet,
subZonesAndFactions (to be set after
zonesAndFactions in
RepByZone:OnEnable()) is still
nil.
I suggest removing
self:SwitchedZones() from
RepByZone:CheckSholazarBasin(). That one line is what's causing all of your problems. If you need to call
RepByZone:SwitchedZones() from
RepByZone:OnEnable(), put it in there.