WoW:API Frame SetScript

Revision as of 17:55, 30 December 2005 by WoWWiki>Muert

Sets the action handler for this frame or removes the handler with a nil function

frame:SetScript("handler", function);

Arguments:

"handler" is the action to set, i.e. "OnShow" or "OnEvent".
function is the function you want to set for the handler.

Example 1:
for i = 1, 4 do
local frame = getglobal("PartyMemberFrame"..i);
frame:SetScript("OnShow", function() this:Hide(); end);
end
Result:
All party frames will be hidden whenever they're shown.


Example 2:
PartyMemberFrame1:SetScript("OnShow", nil);
Result:
Removes the OnShow handler function of PartyMemberFrame1.

Template:WoW API