Hello there! We are conducting a survey to better understand the user experience in making a first edit. If you have ever made an edit on Gamepedia, please fill out the survey. Thank you!
API Frame RegisterEvent
Registers which events the object would like to monitor.
success = frame:RegisterEvent("event")
- string - The name of the event to register the object as monitoring.
- boolean - Returns true if the event was successfully registered, false if (already) registered.
The snippet below creates a frame, registers it for the CHAT_MSG_YELL event, and sets an OnEvent handler that would print a message whenever that event fires -- whenever you hear someone /yell.
local frame = CreateFrame("Frame") frame:RegisterEvent("CHAT_MSG_YELL") frame:SetScript("OnEvent", function(self, event, ...) print("Argh, stop with the yelling!") end)
- Attempting to register for a non-existing event is silently ignored; Frame:IsEventRegistered("event") returns
nilin such a case.
Patch 8.0.1 (2018-07-17): Since patch 8.0.1 registering a non-existing event will raise an error.
- Widgets are notified of an event in order of event registration: the last widget to register for an event will be the last one to receive it.