UnbindKey

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 09:49, 15 August 2026 by QCherry (talk | contribs) (Update Lua API reference)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.