wowpedia
Main Menu


Sets the widget script handler.

ScriptRegion:SetScript(scriptTypeName, script)

Arguments

scriptTypeName
string - Name of the script type, for example "OnShow".
script
function|nil - The script handler to call or explicitly nil to remove any existing script.

Details

Example

Sets the OnEvent script; this 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)