getBoundKeys
Client-side
Server-side
Shared
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
Returns a list of key names that are bound to the specified game control or console command.
Syntax
table getBoundKeys ( string command/control )Required Arguments
- command/control: the name of a game control or a console command. See the control names page for valid controls.
Returns
- table: value
If one or more keys are bound to the specified control or console command, a table is returned indexed by the names of the keys and containing key states as values. If no keys are bound or an invalid name was passed, returns false .
Code Examples
shared
This code adds a command handler with which you can check out the keybinds for any game control. As an example, typing "/keys forwards" would list all the keys which you can press to make the player walk forward.
function keysCommand ( command, controlName ) if not controlName then -- make sure they specified a control name outputChatBox ( "No control name specified", 255, 0, 0 ) return end local keys = getBoundKeys ( controlName ) -- get the keys bound to this control if not keys then -- make sure the control name is valid and any keys are bound to it outputChatBox ( "No keys bound to " .. controlName, 255, 0, 0 ) return end outputChatBox ( "Keys bound to " .. controlName .. ":", 0, 255, 0 ) for keyName, state in pairs(keys) do outputChatBox ( keyName, 0, 255, 0 ) endend
addCommandHandler ( "keys", keysCommand )See Also
Input Functions
- addCommandHandler
- bindKey
- executeCommandHandler
- getAnalogControlState
- getBoundKeys
- getCommandHandlers
- getCommandsBoundToKey
- getFunctionsBoundToKey
- getKeyBoundToCommand
- getKeyBoundToFunction
- getKeyState
- isCapsLockEnabled
- isControlEnabled
- isKeyBound
- removeCommandHandler
- setAnalogControlState
- toggleAllControls
- toggleControl
- unbindKey
Input Events
- onClientCharacter
- onClientClick
- onClientCursorMove
- onClientDoubleClick
- onClientGUIAccepted
- onClientGUIBlur
- onClientGUIChanged
- onClientGUIClick
- onClientGUIComboBoxAccepted
- onClientGUIDoubleClick
- onClientGUIFocus
- onClientGUIMouseDown
- onClientGUIMouseUp
- onClientGUIMove
- onClientGUIScroll
- onClientGUISize
- onClientGUITabSwitched
- onClientKey
- onClientMouseEnter
- onClientMouseLeave
- onClientMouseMove
- onClientMouseWheel
- onClientPaste