Hello, I am experimenting with LUA to see if I can create a text that displays the number of attackable units within 8 yards. While count nameplates does work, I want to see if WA_ConsolidatedUnitTable is more efficient. Unfortunately, my attempts are resulting a nil value error, and I am wondering if I am not using ConsildatedUnitTable correctly.
local enemyCount = 0
for unit in WA_ConsolidatedUnitTable do
if UnitCanAttack("player", unit) and UnitIsVisible(unit) and UnitInRange(unit, 8) then
enemyCount = enemyCount + 1
end
if enemyCount >= 3 then
return true
end
end
return false
end```
WeakAuras Version: 5.4.4
[string "return function()"]:3: attempt to call a nil value
Time: Sun Apr 9 12:24:35 2023
Count: 1
Stack: Lua error in aura 'AttackableCounter': Trigger 1
WeakAuras Version: 5.4.4
[string "return function()"]:3: attempt to call a nil value
[string "@Interface/AddOns/WeakAuras/WeakAuras.lua"]:111: in function `(for generator)'
[string "return function()"]:3: in function <[string "return function()"]:1>
[string "=[C]"]: in function `xpcall'
[string "@Interface/AddOns/WeakAuras/GenericTrigger.lua"]:661: in function <Interface/AddOns/WeakAuras/GenericTrigger.lua:563>
[string "@Interface/AddOns/WeakAuras/GenericTrigger.lua"]:911: in function `CreateFakeStates'
[string "@Interface/AddOns/WeakAuras/WeakAuras.lua"]:4229: in function `UpdateFakeStatesFor'
[string "@Interface/AddOns/WeakAuras/WeakAuras.lua"]:4205: in function `FakeStatesFor'
[string "@Interface/AddOns/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasDisplayButton.lua"]:1445: in function `SyncVisibility'
[string "@Interface/AddOns/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasDisplayButton.lua"]:1471: in function `PriorityShow'
[string "@Interface/AddOns/WeakAurasOptions/WeakAurasOptions.lua"]:728: in function <...terface/AddOns/WeakAurasOptions/WeakAurasOptions.lua:697>
Locals: <none>