Skip to main content

Disconnect the hardware mouse (:disconnect)

This method is available in versions after 20260805

Declaration

success, error_message = mouse_obj:disconnect()

Returns

  • success Boolean. true if disconnection succeeds; otherwise false.
  • error_message String. The reason disconnection failed.

Description

Releases all mouse buttons and disconnects the object. This method may be called repeatedly. XXTouch automatically releases all mouse buttons on explicit disconnection, Lua garbage collection, or script termination. Even if releasing the buttons fails, the object still disconnects and the operation is not retried as a touch event.

Example

local m = assert(mouse.connect())
local ok, err = m:disconnect()
assert(ok, err)