Lists
What are they?
Lists in Aurora Framework are powerful collections of Unit objects that provide various methods for filtering, iterating, and manipulating groups of units. Each list is automatically updated and managed by the ObjectManager.
Available Lists
enemies
Contains enemy units that are relevant to the current context.
local enemies = Aurora.enemies
friends
Contains friendly units, including those not in your group.
local friends = Aurora.friends
group
Contains group members (party/raid) excluding the player.
local group = Aurora.group
fgroup
Contains group members including the player (full group).
local fgroup = Aurora.fgroup
activeenemies
Contains enemy units that are in combat and have threat.
local activeenemies = Aurora.activeenemies
dead
Contains all dead units.
local dead = Aurora.dead
units
Contains all units regardless of type.
local units = Aurora.units
objects
Contains all game objects.
local objects = Aurora.objects
missiles
Contains all missiles.
local missiles = Aurora.missiles
areatriggers
Contains all areatriggers.
local areatriggers = Aurora.areatriggers
List Methods
each(callback)
Iterate through the list with a callback that receives the unit, index, and uptime. Returning true from the callback breaks the loop.
enemies:each(function(unit, i, uptime)
print("Enemy #" .. i .. " has been visible for " .. uptime .. " seconds")
if unit.hp < 20 then
return true -- breaks the loop
end
end)
filter(callback)
Create a new list containing units that match the callback criteria.
local lowHealth = enemies:filter(function(unit)
return unit.hp < 50
end)
first(callback)
Get the first unit that matches the callback criteria.
local target = enemies:first(function(unit)
return unit.hp < 20
end)
random()
Get a random unit from the list.
local randomEnemy = enemies:random()
print(randomEnemy.name)
sort(callback)
Sort the list based on the callback criteria.
enemies:sort(function(a, b)
return a.hp < b.hp
end)
Usage Examples
Basic Iteration
-- Loop through enemies
enemies:each(function(enemy, index, uptime)
print("Processing enemy #" .. index .. " visible for " .. uptime .. " seconds")
if enemy.hp < 20 and enemy.distance < 30 then
-- Do something with low health nearby enemy
return true -- break the loop
end
end)
Filtering and Chaining
-- Get low health enemies and loop through them
enemies:filter(function(unit)
return unit.hp < 50
end):each(function(unit)
-- Heal or damage low health units
end)
Complex Conditions
-- Find specific types of units
local targets = enemies:filter(function(unit)
return unit.ishumanoid
and not unit.dead
and unit.distanceto(player) < 40
and unit.los
end)
targets:each(function(unit)
-- Process filtered units
end)
Group Management
-- Heal group members
group:each(function(member)
if member.hp < 80 and member.distanceto(player) < 40 then
-- Heal the group member
return true
end
end)
Best Practices
- Use
each
instead of Lua'sfor
loops for better control flow - Chain methods when possible to reduce iterations
- Use
filter
when you need to reuse a filtered list multiple times - Break loops early when you find what you need
- Always check unit existence before accessing properties
- Consider range and line of sight for actions
Notes
- Lists only contain valid units/objects
each
: Returns nil. When the callback returns true, the loop breaks earlyfilter
: Returns a new list with filtered unitsfirst
: Returns the first matching unit or nonerandom
: Returns a random unit from the list