API UnregisterStateDriver

From Warcraft Wiki
Jump to navigation Jump to search


UnregisterStateDriver cancels a prior call to RegisterStateDriver for a given frame and stateid.

UnregisterStateDriver(frame, state)

Arguments

frame

  • the frame which you wish to unregister the state driver from

state

  • String - an arbitrary identifier string for this conditional (coerced into lower case), or "visibility"

Returns

none

Notes

It is not necessary to use this function when overwriting an existing state driver with a new one; simply calling RegisterStateDriver will overwrite a previous one provided the state-id is the same. Only use UnregisterStateDriver when the desired result is halting the automation entirely.

The implementation is included as part of FrameXML in FrameXML/SecureStateDriver.lua.

Examples

Registering a state driver to show a frame during combat:

local frame = CreateFrame("Frame")
RegisterStateDriver(frame, "visibility", "[combat]show;hide");  -- the frame is now seen during combat

Removing the state driver:

UnregisterStateDriver(frame, "visibility");   -- the frame no longer responds to entering/leaving combat