WoW:USERAPI Frame UnregisterEvents: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Copy n' Paste error) |
||
Line 5: | Line 5: | ||
== Code == | == Code == | ||
local function | local function UnregisterEvents(self, ...) | ||
for i=1,select('#', ...) do | for i=1,select('#', ...) do | ||
self:UnregisterEvent(select(i, ...)) | self:UnregisterEvent(select(i, ...)) |
Revision as of 23:00, 5 January 2008
This page documents a <i>user-defined function</i> that you can copy and paste into your addon. Replace PREFIX with your addon or lib prefix to avoid conflicts between different versions of these functions.
Add this method to your frame to register multiple events.
Code
local function UnregisterEvents(self, ...) for i=1,select('#', ...) do self:UnregisterEvent(select(i, ...)) end end
Example
local frame = YourEventFrame frame.UnregisterEvents = UnregisterEvents -- Tell the API to stop listen for 'VARIABLES_LOADED', 'ADDON_LOADED', and 'MERCHANT_SHOW' frame:UnregisterEvents('VARIABLES_LOADED', 'ADDON_LOADED', 'MERCHANT_SHOW')
Or unregister events for a frame without attaching UnregisterEvents to the frame:
local frame = YourEventFrame -- Tell the API to stop listen for 'VARIABLES_LOADED', 'ADDON_LOADED', and 'MERCHANT_SHOW' UnregisterEvents(frame, 'VARIABLES_LOADED', 'ADDON_LOADED', 'MERCHANT_SHOW')