#WA_ConsolidatedUnitTable error when counting attackable units

6 messages · Page 1 of 1 (latest)

patent jetty
#

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>
upbeat pecan
#

Where did you find WA_ConsolidatedUnitTable?

patent jetty
#

It had been at this location, but I'm now getting a 404 error https://github.com/WeakAuras/WeakAuras2/blob/main/WeakAurasDocs/WeakAuras-Template.txt#L198

This is the notes I have on WA_ConsilatedUnitTable. I'm currently looking for a URL that isn't broken.

WA_ConsolidatedUnitTable is a global table that is created by the Blizzard UI system, and is not specific to WeakAuras. It contains information about all units that the player is currently aware of.

Information about WA_ConsolidatedUnitTable can be found in the Blizzard API documentation under the "Unit functions" section. Specifically, the "GetNumGroupMembers" and "IsInGroup" functions are often used in conjunction with WA_ConsolidatedUnitTable to determine the number of nearby units and their properties.

upbeat pecan
#

This sounds like someone from ChatGPT WeakAura's isn't created by Blizzard

#

it possible that blizzard removed or changed this though

patent jetty
#

Thanks phoenix, I agree. I'm not seeing ConsolidatedUnitTable in the WA LUA files nor through the Blizzard API documentation. I wonder where the reference originated from. Guess I'll keep counting nameplates