WoW:API GetBindingText: Difference between revisions
No edit summary |
m (Move page script moved page API GetBindingText to API GetBindingText without leaving a redirect) |
||
| (3 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
< | <br>{{framexmlfunc|FrameXML/UIParent.lua}} __NOTOC__ | ||
text = GetBindingText(key,prefix,abbreviate) | |||
Returns the localized string value for the given key and prefix. Essentially a glorified getglobal() function. | |||
== Parameters == | |||
=== Arguments === | |||
: | :(String key, String prefix, [Boolean abbreviate]) | ||
:; | :;key : String - The name of the key (e.g. "UP", "SHIFT-PAGEDOWN") | ||
:;prefix : String - The prefix of the variable name you're looking for. Usually "KEY_" or "BINDING_NAME_". | |||
:;abbreviate : Boolean (optional) - Whether to return an abbreviated version of the modifier keys | |||
=== Returns === | |||
:;value : String - The value of the global variable derived from the prefix and key name you specified. For example, "UP" and "KEY_" would return the value of the global variable KEY_UP which is "Up Arrow" in the english locale. If the global variable doesn't exist for the combination specified, it appears to just return the key name you specified. Modifier key prefixes are stripped from the input and added back in to the output. | |||
The third parameter, if true, causes the function to simply substitute the abbreviations 'c', 'a', 's', and 'st' for the strings CTRL, ALT, SHIFT, and STRG (German client only) in the result. | |||
== Example == | |||
val = GetBindingText("UP", "KEY_"); | val = GetBindingText("UP", "KEY_"); | ||
-- val is "Up Arrow" | -- val is "Up Arrow" | ||
Latest revision as of 04:45, 15 August 2023
This function is implemented in Lua here FrameXML/UIParent.lua.
text = GetBindingText(key,prefix,abbreviate)
Returns the localized string value for the given key and prefix. Essentially a glorified getglobal() function.
Parameters
Arguments
- (String key, String prefix, [Boolean abbreviate])
- key
- String - The name of the key (e.g. "UP", "SHIFT-PAGEDOWN")
- prefix
- String - The prefix of the variable name you're looking for. Usually "KEY_" or "BINDING_NAME_".
- abbreviate
- Boolean (optional) - Whether to return an abbreviated version of the modifier keys
Returns
- value
- String - The value of the global variable derived from the prefix and key name you specified. For example, "UP" and "KEY_" would return the value of the global variable KEY_UP which is "Up Arrow" in the english locale. If the global variable doesn't exist for the combination specified, it appears to just return the key name you specified. Modifier key prefixes are stripped from the input and added back in to the output.
The third parameter, if true, causes the function to simply substitute the abbreviations 'c', 'a', 's', and 'st' for the strings CTRL, ALT, SHIFT, and STRG (German client only) in the result.
Example
val = GetBindingText("UP", "KEY_");
-- val is "Up Arrow"