ScriptObject:SetScript()

From Wowpedia
Jump to: navigation, search

Sets the widget's script handler.

ScriptObject:SetScript(scriptType, handler)

Arguments

scriptType 
string - Name of the script type, e.g. "OnShow".
handler 
function - The function to call when handling the specified widget event, or nil to remove any existing script.

Details

Examples

Sets the OnEvent script for a Frame; which prints when your character starts moving.

local function OnEvent(self, event)
	print(event)
end

local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_STARTED_MOVING")
f:SetScript("OnEvent", OnEvent)

Patch changes

External links

References