Quantcast ESOUI - View Single Post - IsEventRegistered()
View Single Post
07/10/19, 02:02 PM   #1
Letho
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 237
IsEventRegistered()

Hey guys, is it possible to check wether an event is already registered? If I register the same event multiple times, it seems not to be overwritten but registering multiple times which is very odd behavior.

Example:
Lua Code:
  1. function AuraMastery:RegisterForEvent(eventId, abilityId)
  2.         local eventNamespace = "AM_"..eventId..abilityId
  3.     local eventHandler = MyHandler
  4.     EVENT_MANAGER:RegisterForEvent(eventNamespace, eventId, eventHandler)
  5.     EVENT_MANAGER:AddFilterForEvent(eventNamespace, eventId, REGISTER_FILTER_ABILITY_ID, abilityId)
  6. end

AuraMastery:RegisterForEvent(EVENT_COMBAT_EVENT, 30920)
AuraMastery:RegisterForEvent(EVENT_COMBAT_EVENT, 30920)


Any use of ability(30920) will trigger MyHandler TWO TIMES! instead of one time.

I need a function to determine if an event of specified Namespace and filter /w abilityId is already registered.

(I know I could handle it manually by saving it to a table onRegistering, but maybe there is a more elegant way
  Reply With Quote