- Documentation
- Shared functions
- getKeyBoundToFunction
Function
getKeyBoundToFunction
Returns the first key a function is bound to.
Syntax
Server
string getKeyBoundToFunction(player thePlayer, function handler)Client
string getKeyBoundToFunction(function handler)Arguments
thePlayerplayer- The player (server only).
handlerfunction- The function.
Returns
The key or false.
Example
local function toggleMenu() end
bindKey("F4", "down", toggleMenu)
outputChatBox("Menu: " .. tostring(getKeyBoundToFunction(toggleMenu)))
See also
bindKeyBinds a function or a command to a player's key. The function gets (on the server also the player) the key name, the state and the extra arguments frombindKey. Instead of a function you can pass a command name: the key runs it like/command. On the server the player's game watches the key and reports presses to the server.getFunctionsBoundToKeyReturns the functions (and command names) bound to a key.