wowpedia
Main Menu


Sets a key binding to an action.

ok = SetBinding(key [, command, mode])

Arguments

key
string - Any binding string accepted by World of Warcraft. For example: "ALT-CTRL-F", "SHIFT-T", "W", "BUTTON4".
command
string? - Any name attribute value of a Bindings.xml-defined binding, or an action command string, or nil to unbind all bindings from key. For example:
  • "SITORSTAND" : a Bindings.xml-defined binding to toggle between sitting and standing
  • "CLICK PlayerFrame:LeftButton" : Fire a left-click on the PlayerFrame.
  • "SPELL Bloodrage" : Cast Bloodrage.
  • "ITEM Hearthstone" : Use  [Hearthstone]
  • "MACRO Foo" : Run a macro called "Foo"
  • "MACRO 1" : Run a macro with index 1.
mode
number? - 1 if the binding should be saved to the currently loaded binding set (default), or 2 if to the alternative.

Returns

ok
boolean - 1 if the binding has been changed successfully, nil otherwise.

Example

-- Remove all bindings from the right mouse button.
SetBinding("BUTTON2");
-- Restore the default binding for the right mouse button.
SetBinding("BUTTON2","TURNORACTION");

Details

See also