UnbindKey: Difference between revisions
Jump to navigation
Jump to search
Update Lua API reference |
Complete Lua function catalog |
||
| Line 38: | Line 38: | ||
* If the removed key currently owns native input capture, control is returned to the game immediately unless another GUI or binding still owns it. | * If the removed key currently owns native input capture, control is returned to the game immediately unless another GUI or binding still owns it. | ||
[[Category:Lua Functions]] | |||
[[Category:Client Functions]] | [[Category:Client Functions]] | ||
[[Category:Input Functions]] | [[Category:Input Functions]] | ||
Latest revision as of 09:55, 15 August 2026
unbindKey
Removes one or more key bindings owned by the current client resource.
Syntax
bool unbindKey(string keyName [, string keyState [, function handler]])
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
keyName |
string |
yes | The case-insensitive key name used by bindKey.
|
keyState |
string |
no | Optional down, up or both filter.
|
handler |
function |
no | Optional callback filter. Omit it to remove every matching callback. |
Returns
Returns true if at least one binding was removed; otherwise returns false.
Examples
Remove a previously registered Tab binding:
local function handleScoreboard(keyName, keyState)
-- Update the scoreboard.
end
bindKey("tab", "both", handleScoreboard)
unbindKey("tab", "both", handleScoreboard)
Notes
- Available only in client-side resource scripts.
- Calling
unbindKey(keyName)removes all states and callbacks for that key in the current resource. - If the removed key currently owns native input capture, control is returned to the game immediately unless another GUI or binding still owns it.