Wikia

WoWWiki

Frame:RegisterEvents

Talk0
98,452pages on
this wiki
This is a user-defined function that you can copy and paste into your addon. Replace <PREFIX> with your AddOn's prefix to avoid conflicts between different versions of these functions.

Add this method to your frame to register multiple events.

Code

local function RegisterEvents(self, ...)
	for i=1,select('#', ...) do
		self:RegisterEvent(select(i, ...))
	end
end

Example

-- Create an anonymous blank frame
local frame = CreateFrame('Frame')
frame.RegisterEvents = RegisterEvents

-- Tell the API to listen for 'VARIABLES_LOADED', 'ADDON_LOADED', and 'MERCHANT_SHOW'
frame:RegisterEvents('VARIABLES_LOADED', 'ADDON_LOADED', 'MERCHANT_SHOW')

Or register events for a frame without attaching RegisterEvents to the frame:

-- Create an anonymous blank frame
local frame = CreateFrame('Frame')

-- Tell the API to listen for 'VARIABLES_LOADED', 'ADDON_LOADED', and 'MERCHANT_SHOW'
RegisterEvents(frame, 'VARIABLES_LOADED', 'ADDON_LOADED', 'MERCHANT_SHOW')
Advertisement | Your ad here

Photos

Add a Photo
61,966photos on this wiki
See all photos >

Recent Wiki Activity

See more >

Around Wikia's network

Random Wiki