- Documentation
- Server functions
- getCommandHandlers
Function
getCommandHandlers
Returns the names of commands registered by a resource, or by every resource without an argument.
Syntax
table getCommandHandlers([resource theResource])Arguments
theResourceresource, optional- The resource.
Returns
A table of command names.
Example
addCommandHandler("komendy", function(player)
local list = getCommandHandlers(getThisResource())
outputChatBox("Komendy: /" .. table.concat(list, ", /"), player)
end)
See also
addCommandHandlerRegisters a chat and console command (e.g./car). When a player types it, the function is called. On the server the function gets the player, the command name and the following words as separate arguments; on the client the command name and the words. One command can have several functions, also from different resources. The command goes away with the resource that added it.getBuiltinCommandsReturns the server's built-in commands, the ones no resource adds (e.g.me,pm,kick). With a player it returns only the commands that player may use according toadmins.xml. Useful for a custom chat that recognises commands itself.