Skip to main content

Release a hardware keyboard key (:up)

This method is available in versions after 20260805

Declaration

success, err = keyboard:up(key)
success, err = keyboard:up(usage_page, usage_id)

Parameters

  • key String. Uses the same key-name mapping as key.press.
  • usage_page Integer. Hardware keyboard objects currently accept only Keyboard/Keypad Usage Page 0x07.
  • usage_id Integer. Physical key identifier, not a character encoding.

Returns

  • success Boolean. Returns true when the key is released successfully and false on failure.
  • err String. Error message returned when sending fails.

Description

Release a hardware keyboard key previously held by :down.

If the same keyboard is running a :press or :send_text sequence, this method returns false, "hardware keyboard is busy". Failed input is not retried through another input method.

Example

local keyboard = assert(key.connect_keyboard())

assert(keyboard:down("LEFTSHIFT"))
assert(keyboard:up("LEFTSHIFT"))

assert(keyboard:disconnect())