getCommandHandlers
Client-side
Server-side
Shared
This page is incomplete! Help wanted!
Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.
This function is used to retrieve a list of all the registered command handlers of a given resource (or of all resources). Function also added client-side.
Syntax
getCommandHandlers ( )Code Examples
server
This example add a command to output list of all commands in the chat.
addCommandHandler( "commands", function(player) local commandsList = {} --table to store commands
--store/sort commands in the table where key is resource and value is table with commands for _, subtable in pairs( getCommandHandlers() ) do local commandName = subtable[1] local theResource = subtable[2]
if not commandsList[theResource] then commandsList[theResource] = {} end
table.insert( commandsList[theResource], commandName ) end
--output sorted information in the chat for theResource, commands in pairs( commandsList ) do local resourceName = getResourceInfo( theResource, "name" ) or getResourceName( theResource ) --try to get full name, if no full name - use short name outputChatBox( "== "..resourceName.. " ==", player, 0, 255, 0 )
--output list of commands for _, command in pairs( commands ) do outputChatBox( "/"..command, player, 255, 255, 255 ) end end end)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