Skip to main content

Get the current global hardware keyboard (key.get_global_keyboard)

This function is available in versions after 20260805

Declaration

keyboard = key.get_global_keyboard()

Returns

  • keyboard The currently connected global hardware keyboard object, or nil when no object is available.

Description

Call key.get_global_keyboard() to get the global hardware keyboard object connected by key.connect_global_keyboard.

This function returns nil when no keyboard is connected, while a connection is in progress, or after the device has disconnected.

Example

local keyboard = key.get_global_keyboard()
if keyboard then
assert(keyboard:press("RETURN"))
end