WoW:API GetBinding: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (Move page script moved page API GetBinding to API GetBinding without leaving a redirect) |
||
(One intermediate revision by one other user not shown) | |||
Line 23: | Line 23: | ||
if (key1) then DEFAULT_CHAT_FRAME:AddMessage(key1,1.0,1.0,1.0); end | 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 | if (key2) then DEFAULT_CHAT_FRAME:AddMessage(key2,1.0,1.0,1.0); end | ||
---- | |||
;''Notes'' | |||
It may also be helpful to use the [[API_select | select]] function to return a table of all the values. See the [[API_select | select]] page example of the Catenation function. |
Latest revision as of 04:45, 15 August 2023
← WoW API < GetBinding
Returns the command name and all keys currently bound to the command specified by index. This would generally be used in conjunction with GetNumBindings() to loop through and set/get all of the key bindings available.
- Arguments
- (Int index)
- index
- A value from 1 to X where X is the number returned from GetNumBindings()
- Returns
- command, key1, key2, ..., keyN
- command
- (string) The name of the command the keys are bound to (e.g. MOVEFORWARD, TOGGLEFRIENDSTAB). Used in GetBindingKey("command") among other things.
- key1-N
- (string) The string representation of the key bound to this command (e.g. W, CTRL-F). 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"}).
- Example
command, key1, key2 = GetBinding(5); DEFAULT_CHAT_FRAME:AddMessage(command.." 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
- Notes
It may also be helpful to use the select function to return a table of all the values. See the select page example of the Catenation function.