LibCombatLogEvent-1.0 dispatchs combat log events using CallbackHandler-1.0, passing along a table with the event arguments. It integrates nicely with AceAddon-3.0 addons and use an efficient argument parsing.

AceAddon-3.0 integration

Quite simple, here is a basic sample:

local myAddon = LibStub('AceAddon-3.0'):NewAddon("foo", "LibCombatLogEvent-1.0")

function myAddon:OnEnable()

function myAddon:UNIT_DIED(event, eventArgs)
  print("Oh noes !", eventArgs.destName, "died !")

No need to unregister the event in OnDisable, the library takes care of it.


The library is based on CallbackHandler-1.0. The callback names are the COMBAT_LOG_EVENT_UNFILTERED (CLEU) event names.


myAddon:RegisterCombatLogEvent("eventName"[, methodNameOrFunc[, arg]])
library.RegisterCombatLogEvent(myTable, "eventName"[, methodNameOrFunc[, arg]])
library.RegisterCombatLogEvent("myAddonId", "eventName"[, func[, arg]])

Register a callback for the given myAddon/myTable/"myAddonId" and CLEU event.

The callback should have one of the following signatures:

function myAddon:method([arg, ]event, eventArgs)
function myTable:method([arg, ]event, eventArgs)
function func([arg, ]event, eventArgs)


myAddon:UnregisterCombatLogEvent("eventName"[, methodNameOrFunc[, arg]])
library.UnregisterCombatLogEvent(myTable, "eventName"[, methodNameOrFunc[, arg]])
library.UnregisterCombatLogEvent("myAddonId", "eventName"[, func[, arg]])

Unregister the myAddon/myTable/"myAddonId" callback for the given event.



Unregister all myAddon/myTable/"myAddonId" callbacks.

The eventArgs table

The event table is filled with the parameters of the COMBAT_LOG_EVENT_UNFILTERED event. For convenience, these positional parameters are mapped to named ones using this page:

Important: the passed eventArgs is a table shared amongst all callbacks and reused on subsequent callbacks. Do not modifiy it or store a reference to it. If you absolutely need to modify it or keep the values, make a copy first.

For example, for the SPELL_MISS event, the table would be it was defined that way:

eventArgs  = {
  event = "SPELL_MISS",
  timestamp = ...,
  sourceGUID = ...,
  sourceName = ...,
  sourceFlags = ...,
  destGUID = ...,
  destName = ...,
  destFlags = ...,
  spellId = ...,
  spellName = ...,
  spellSchool = ...,
  missType = ...,
  amountMissed = ...

You must login to post a comment. Don't have an account? Register to get one!