Binds a key combination to a binding command


See also Keybind functions.

Signature:

success = SetBinding("key" [, "command"])

Arguments:

  • key - A key or key combination (e.g. "CTRL-2") (string, binding)
  • command - Name of a key binding command, or nil to unbind the key (string)

Returns:

  • success - 1 if the key binding (or unbinding) was successful; otherwise nil (1nil)

Examples:

-- Bind Control-Y to FOLLOWTARGET
SetBinding("CTRL-Y", "FOLLOWTARGET")

-- Unbind MouseButton4
SetBinding("BUTTON4")