Type Function Library system.* Return value Array of InputDevice devices Revision 2019.3527 Keywords getInputDevices See also InputDevice InputAxis
Returns an array of InputDevice devices that are currently connected to the system, such as a touchscreen, keyboard, mouse, joystick, etc. Alternatively returns an empty array if no input devices are found. Note that input devices which were once connected but were later disconnected will not be returned by this function.
This function is intended to be called on application start and application resume. During normal runtime, it's better to use the inputDeviceStatus event instead — this event is triggered when new input devices are connected to the system or when existing devices are disconnected.
-- Fetch all input devices currently connected to the system local inputDevices = system.getInputDevices() -- Print all of the input devices found if ( #inputDevices > 0 ) then print( "Input devices found:" ) for index = 1,#inputDevices do print( index .. ") " .. inputDevices[index].displayName ) end else print( "No input devices found!" ) end