UnitAuraSlots

From Warcraft Wiki
Jump to navigation Jump to search

Returns an ordered list of auras used with UnitAuraBySlot()

continuationToken, ... = UnitAuraSlots(unit, filter [, maxSlots, continuationToken])

Arguments

unit
string : UnitId
filter
string - Similar to UnitAura; however, either "HELPFUL" or "HARMFUL" is required.
maxSlots
number? - The maximum number of slots to return
continuationToken
number? - The number of slots to skip.

Returns

continuationToken
number? - Indicates that maxSlots was reached.
...
number - A batch of slots used with UnitAuraBySlot()

Details

It's recommended to just use AuraUtil.ForEachAura() instead of UnitAuraBySlot() & UnitAuraSlots() as it'll "do the right thing". Note that this API is not available on Classic.

2022-08-25 | Meorawr @ Discord

With UnitAura the index parameter is a relative index into a list of auras specified by the filter parameter - so assuming zero optimizations each call effectively means that the client needs to traverse over the aura list each time counting how many auras match the given filter until the index is reached.

In reality it's likely got a basic optimization in-place that allows successive calls with the same unit/filter parameter to continue, thus bypassing that search.

UnitAuraSlots "advantage" is that it:

  1. Doesn't return just one aura slot.
  2. It returns a continuation token marking the number of slots the API can skip on the next call - basically making that above theoretical optimization explicit.

Patch changes

Dragonflight Patch 10.2.5 (2024-01-16): Deprecated. Replaced by C_UnitAuras.GetAuraSlots.
Battle for Azeroth Patch 8.2.5 (2019-09-24): Added.