Wowpedia
Advertisement
This function is implemented by FrameXML in FrameXML/SecureHandlers.lua.

Wraps a widget script with code snippets that execute in the RestrictedEnvironment.

SecureHandlerWrapScript(frame, script, header, preBody [, postBody])
SecureHandlerBaseTemplate:WrapScript(header, script, preBody [, postBody])

Arguments

frame 
Frame - A protected frame whose widget script will be wrapped.
script 
string - Eligible widget script handlers defined in LOCAL_Wrap_Handlers (see below).
header 
Frame - A protected frame whose secure handle will be passed to the code snippet as 'self'.
preBody 
string - A code snippet limited to the RestrictedEnvironment, to fire before the frame's normal widget script. Behaves like the body of a function, with predetermined arguments and return values.
postBody 
string?Optional. Could be nil. - A second code snippet to fire afterwards, but only if preBody returns arguments to trigger it.

Details

  • Each kind of preBody code snippet may also return values which change how execution proceeds, potentially halting or modifying the wrapped widget script.
  • The 'message' return value also determines if postBody will fire, and is passed to postBody as an argument.
  • Note the arguments are in a different order when using SecureHandlerWrapScript() on any protected frame, or the WrapScript() method on the SecureHandlers.

Eligible Handlers

OnEnter, OnLeave, OnShow, OnHide, OnMouseWheel, OnAttributeChanged
allow, message = preBody(self)
postBody(self, message)
allow 
boolean?Optional. Could be nil. - Halts subsequent execution unless allow ~= false
message 
any type - If non-nil, triggers postBody and passed as 'message' (unless execution was halted).
OnClick, OnDoubleClick, PreClick, PostClick
newbutton, message = preBody(self, button, down)
postBody(self, message, button, down)
newbutton 
string?Optional. Could be nil. - If non-nil, changes 'button' in subsequent execution.
message 
any type - If non-nil, triggers postBody and passed as 'message'.
OnDragStart, OnReceiveDrag
... = preBody(self, button, down)
postBody(self, message, button)
retVal1 
string?Optional. Could be nil. - If non-nil, the first argument may either be "clear" (clears the cursor), "message" (triggers postBody) or any other string to replace 'kind' in subsequent execution.
retVal2 
string?Optional. Could be nil. - If retVal1 was "clear" then retVal2 may be "message" or a replacement of 'kind' in subsequent execution. If retVal1 was "message" then retVal2 is passed as 'message' to postBody.
... 
Other return values used in the override of subsequent execution, if applicable.

Patch changes

External links

Advertisement