AddOn Studio Wiki

WoW API < GetBindingKey


Returns all keys currently bound to the command specified by command. This function is almost identical to GetBinding(index) except it takes the command name as an argument instead of the index and doesn't return the command name along with the key bindings.

(String command)
The name of the command to get key bindings for (e.g. MOVEFORWARD, TOGGLEFRIENDSTAB)

key1, key2, ..., keyN
(string) The string representation of the key bound to this command (e.g. W, UP). Even though the default key binding GUI window only displays 2 possible keys bound to each command, it appears there is no limit to the number of keys that can be bound to a single command. This function will return as many keys as have been set with SetBinding("key"{,"command"}). If no keys are bound to the action, it will return nil.

key1, key2 = GetBindingKey("MOVEFORWARD");
DEFAULT_CHAT_FRAME:AddMessage("Move Forward has the following keys bound:",1.0,1.0,1.0);
if (key1) then DEFAULT_CHAT_FRAME:AddMessage(key1,1.0,1.0,1.0); end
if (key2) then DEFAULT_CHAT_FRAME:AddMessage(key2,1.0,1.0,1.0); end