WoW:API Frame GetScript: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Created page with "{{widgetmethod}} Gets an event handler for a specific event type for this frame. local func = frame:GetScript("handler") == Parameters == === Arguments === :;handler : str...")
 
m (Move page script moved page API Frame GetScript to API Frame GetScript without leaving a redirect)
 
(No difference)

Latest revision as of 04:45, 15 August 2023

Widget API ← Frame < GetScript

Gets an event handler for a specific event type for this frame.

local func = frame:GetScript("handler")

Parameters[edit]

Arguments[edit]

handler
string - the name of the handler type, like 'OnShow', 'OnEvent'. See Widget handlers.

Returns[edit]

func
function - The function that will be called on event or 'nil' if no handler


Examples[edit]

for i = 1, 4 do
    local frame = _G["PartyMemberFrame"..i]
    print(frame:GetScript("OnShow"))
end

Prints the function ids of the 'OnShow' event handlers for all party frames, to the chat frame.

PartyMemberFrame1:GetScript("OnHide")

Gets whatever 'OnShow' handler was set for 'PartyMemberFrame1'.

See also[edit]