Using bindings.xml to create key bindings for your addon

Example:

bindings.xml   DoSomething;   if ( keystate == "down" ) then DoSomethingElse; else DoSomethingYetDifferent; end   DoOneThing;  

dostuff.lua

-- Binding Variables BINDING_HEADER_MYDOSTUFF = "The header"; BINDING_NAME_DOSTUFF = "a name"; BINDING_NAME_DOOTHERSTUFF = "another name"; BINDING_NAME_DOMORESTUFF = "yet another name";

As of 2.0, "dummy" bindings (bindings containing only a comment) can be used with names that match the Bindings.xml syntax for saving spell, item, macro and click bindings. Because these terms have spaces in them, you will need to use global name-string references to set the names that appear by them.

Bindings.xml   -- Corruption   -- HNB   -- blitz   -- menu! </Binding> </Bindings>

The above code is equivalent to the below code, except with the above, the user chooses the bindings and with the below, the coder chooses the bindings.

SetBindingSpell(key, "Corruption") SetBindingItem(key, "Heavy Netherweave Bandage") SetBindingMacro(key, "RawrBomb!") SetBindingClick(key, "TargetFrame", "RightButton")

yourAddon.lua _G["BINDING_NAME_SPELL Corruption"] = "Dot 'em up!" _G["BINDING_NAME_CLICK TargetFrame:RightButton"] = "Open your target menu"