# isKeyBound (Shared)

> Tells whether this resource bound a function to a key.

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

## Syntax

```lua
bool isKeyBound(player thePlayer, string key [, string keyState = both, function handler = nil])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `thePlayer` | `player` | Server only: the player the bind belongs to. On the client, leave this argument out. |
| `key` | `string` | The key's name, in any case: `a` to `z`, `0` to `9`, `F1` to `F12`, `mouse1` to `mouse5`, `mouse_wheel_up`, `mouse_wheel_down`, `arrow_l`, `num_0`, `space`, `enter`, `lshift` and others. |
| `keyState` | `string` | Which binds to look at: `"down"`, `"up"` or `"both"`. *(default: `both`)* |
| `handler` | `function` | The function to look for. Without it, any function counts. *(default: `nil`)* |

## Returns

`true` if this resource has a function bind on the key, `false` otherwise.

Only function binds count: a command bound to the key is not seen.

## Example

```lua
local function honk()
    outputDebugString("beep")
end

if not isKeyBound("h", "down", honk) then
    bindKey("h", "down", honk)
end
```

## 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.
- [unbindKey (Shared)](https://wiki.mymp.gg/en/unbindKey.md): Removes binds this resource made on a key.
- [getFunctionsBoundToKey (Shared)](https://wiki.mymp.gg/en/getFunctionsBoundToKey.md): Lists the functions this resource bound to a key.
