Disconnect a hardware keyboard (:disconnect)
This method is available in versions after 20260805
Declaration
success, err = keyboard:disconnect()
Returns
- success
Boolean. Returns
trueafter successful disconnection andfalseon failure. - err String. Error message returned when disconnection fails.
Description
Releases all keys and disconnects this hardware keyboard object.
- This method may be called repeatedly.
- If the object is the current global hardware keyboard, this method also clears the global keyboard connection.
- If the same hardware keyboard is running a
:pressor:send_textsequence, this method returnsfalse, "hardware keyboard is busy". - When Lua collects a hardware keyboard object or the script stops, XXTouch also releases all keys and disconnects the object.
Example
local keyboard = assert(key.connect_keyboard())
local success, err = keyboard:disconnect()
assert(success, err)