GetKeyBoundToFunction: Difference between revisions
Jump to navigation
Jump to search
(→Syntax) |
mNo edit summary |
||
Line 30: | Line 30: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function chat () | function chat () | ||
outputChatBox("Test") | outputChatBox("Test") | ||
end | end | ||
bindKey("F2","down",chat) | bindKey("F2","down",chat) | ||
function key() | function key() | ||
local boundKey = getKeyBoundToFunction(chat) | |||
outputChatBox( | outputChatBox(boundKey) | ||
end | end | ||
addCommandHandler("key",key) | addCommandHandler("key",key) | ||
Line 45: | Line 45: | ||
==See Also== | ==See Also== | ||
{{Input_functions}} | {{Input_functions}} | ||
Latest revision as of 11:20, 28 September 2013
getKeyBoundToFunction allows retrieval of the first key bound to a function.
Syntax
Click to collapse [-]
Serverstring getKeyBoundToFunction( player thePlayer, function theFunction )
Required Arguments
- thePlayer: The player you are checking the function bound to a key
- theFunction: The function in which you would like to check the bound key
Returns
Returns a string of the first key the function was bound to.
Click to collapse [-]
Clientstring getKeyBoundToFunction( function theFunction )
Required Arguments
- theFunction: The function in which you would like to check the bound key
Returns
Returns a string of the first key the function was bound to.
Example
Click to collapse [-]
Client/key command gives bounded key to our chat function
function chat () outputChatBox("Test") end bindKey("F2","down",chat) function key() local boundKey = getKeyBoundToFunction(chat) outputChatBox(boundKey) end addCommandHandler("key",key)
This example written by Samurai
See Also
- addCommandHandler
- bindKey
- executeCommandHandler
- getCommandHandlers
- getFunctionsBoundToKey
- getKeyBoundToFunction
- isControlEnabled
- removeCommandHandler
- toggleAllControls
- toggleControl
- unbindKey