# getKeyBoundToFunction (Shared)

> Tells which key this resource bound a function to.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Keyboard
- **URL**: https://wiki.mymp.gg/en/getKeyBoundToFunction

## Syntax

```lua
string|false getKeyBoundToFunction(player thePlayer, function handler)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `thePlayer` | `player` | Server only: the player the bind belongs to. On the client, leave this argument out. |
| `handler` | `function` | The function to look for. |

## Returns

The name of the first key found, or `false` if the function is not bound.

## Example

```lua
local function openMap()
    outputDebugString("map")
end

bindKey("F11", "down", openMap)
outputDebugString("Map key: " .. tostring(getKeyBoundToFunction(openMap)))
```

## See also

- [bindKey (Shared)](https://wiki.mymp.gg/en/bindKey.md): Binds a key to a function or a command. The function runs when the key is pressed, released or both.
- [getFunctionsBoundToKey (Shared)](https://wiki.mymp.gg/en/getFunctionsBoundToKey.md): Lists the functions this resource bound to a key.
- [unbindKey (Shared)](https://wiki.mymp.gg/en/unbindKey.md): Removes binds this resource made on a key.
