CombatLogSetCurrentEntry

From Warcraft Wiki
Jump to navigation Jump to search
Flavors
Links
Info
Added in 2.4.0 / 1.13.2

Sets the currently selected combat log entry to the given value, to be retrieved using CombatLogGetCurrentEntry().

CombatLogSetCurrentEntry(index [, ignoreFilter])

Arguments

index
number - see details below
ignoreFilter
boolean - set to true to ignore combat log filters

Returns

isValidIndex
boolean - will return false if the index does not exist in the combat log, but will still set the entry. Otherwise, returns true for valid indices.

Details

Combat log indexing works a bit differently than standard Lua indexing. You can treat the combat log like a big table, with the oldest entries being placed at the beginning, and the newest entries at the end.

Unlike standard Lua tables, however, an index of 0 will set the entry to the most recent combat log entry. Additionally, you are also able to index the combat log backwards using negative values. For example, an index of -1 will return the second to last, or second most recent entry in the combat log.

See CombatLogAdvanceEntry() for details on traversing the combat log.

Examples

  • Combat log indexing
CombatLogSetCurrentEntry(0, true); -- most recent entry, ignoring filters.
local newestEntry = {CombatLogGetCurrentEntry()};

CombatLogSetCurrentEntry(1, true); -- oldest entry, ignoring filters.
local oldestEntry = {CombatLogGetCurrentEntry()};

CombatLogSetCurrentEntry(-5, true); -- fifth newest entry, ignoring filters.
local fifthNewestEntry = {CombatLogGetCurrentEntry()};

CombatLogSetCurrentEntry(5, true); -- fifth oldest entry, ignoring filters.
local fifthOldestEntry = {CombatLogGetCurrentEntry()};

References

CombatLogGetCurrentEntry()

CombatLogAdvanceEntry()