类型 字符串 对象 InputDevice 修订 发行版 2024.3703 关键字 设备、输入、connectionState
指示输入设备与系统(如“已连接”、“已断开连接”等的当前连接状态。
可能的返回值为
状态 说明 “已连接” 表示输入设备可用,并且可以提供输入事件。 “已断开连接” 表示与输入设备的连接已丢失。将不会再提供输入事件。 “连接中” 预留供将来使用。 “断开连接中” 预留供将来使用。
-- Called when the status of an input device has changed. local function onInputDeviceStatusChanged( event ) if event.connectionStateChanged then print( event.device.displayName .. ": " .. event.device.connectionState ) end end -- Set up the above function to receive input device status change events. Runtime:addEventListener( "inputDeviceStatus", onInputDeviceStatusChanged )