IsKeyBound: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">bool isKeyBound ( player thePlayer, string key, [ string keyState, | <syntaxhighlight lang="lua">bool isKeyBound ( player thePlayer, string key, [ string keyState, function handler ] ) </syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
Line 14: | Line 14: | ||
**'''"up":''' when the key is released | **'''"up":''' when the key is released | ||
**'''"down":''' when the key is pressed | **'''"down":''' when the key is pressed | ||
*''' | *'''handler:''' The function you're checking against | ||
Note: If you do not specify a ''keyState'' or '' | Note: If you do not specify a ''keyState'' or ''handler'', any instances of ''key'' being bound will cause ''isKeyBound'' to return ''true''. | ||
==Example== | ==Example== |
Revision as of 10:29, 18 August 2007
This function can be used to find out if a key has already been bound.
Syntax
bool isKeyBound ( player thePlayer, string key, [ string keyState, function handler ] )
Required Arguments
- thePlayer: The player you're checking.
- key: The key you're checking. See Key names for a list of valid key names.
Optional Arguments
- keyState: Is the state of the key when it calls the function, Can be either:
- "up": when the key is released
- "down": when the key is pressed
- handler: The function you're checking against
Note: If you do not specify a keyState or handler, any instances of key being bound will cause isKeyBound to return true.
Example
See Also
- addCommandHandler
- bindKey
- executeCommandHandler
- getCommandHandlers
- getFunctionsBoundToKey
- getKeyBoundToFunction
- isControlEnabled
- removeCommandHandler
- toggleAllControls
- toggleControl
- unbindKey