object.type

Type String
Object InputAxis
Revision 2017.3111
Keywords device, input, axis, type

Overview

A string describing the type of axis input that an InputDevice has, such as x or y for a joystick's x axis or y axis input. See Type Names below for a complete list of values.

Gotchas

You should not rely on this property to identify the actual axis, since identifying the axis types of an input device is highly unreliable. It is common for an axis to misidentify itself, for example an axis identified as rotationZ for the x axis of a right thumbstick. This is because there isn't a common standard for input device manufacturers beyond the first two axis inputs being the x and y of a joystick. Thus, you should not rely on this type property — it's better to provide a key and axis binding screen to the user for mapping input controls, much like how it's done for desktop games.

Type Names

Name Description
unknown The type of axis input is unknown.
x For a joystick or gamepad, this is the absolute x axis position of the stick.
For a touchscreen or mouse, this is the cursor's x axis position on the screen, in pixels.
For a touchpad, this is the absolute x axis position on the pad.
y For a joystick or gamepad, this is the absolute y axis position of the stick.
For a touchscreen or mouse, this is the cursor's y axis position on the screen, in pixels.
For a touchpad, this is the absolute y axis position on the pad.
z Represents the z axis for a 3D input device.
rotationX Indicates that the device provides rotation input around the x axis.
rotationY Indicates that the device provides rotation input around the y axis.
rotationZ Indicates that the device provides rotation input around the z axis. This is commonly used by a flightstick where the joystick can be rotated to conrol the rudder.
hatX The absolute x axis position of a hat switch, typically found at the top of a flightstick.
hatY The absolute y axis position of a hat switch, typically found at the top of a flightstick.
leftTrigger The left analog trigger on a gamepad.
rightTrigger The right analog trigger on a gamepad.
gas Indicates that the device provides "gas pedal" input. On Android, this will sometimes represent the right analog trigger on a gamepad.
brake Indicates that the device provides "brake pedal" input. On Android, this will sometimes represent the left analog trigger on a gamepad.
wheel Provides the absolute position of a steering wheel.
rudder Absolute position of the rudder from a flightstick or pedals.
throttle Absolute position of a throttle or slider device.
whammyBar Absolute position of the whammy bar from a guitar.
leftX The absolute x axis position of the left thumbstick on a Windows XInput gamepad.
leftY The absolute y axis position of the left thumbstick on a Windows XInput gamepad.
rightX The absolute x axis position of the right thumbstick on a Windows XInput gamepad.
rightY The absolute y axis position of the right thumbstick on a Windows XInput gamepad.
verticalScroll Provides relative vertical movements from a scroll wheel or scroll ball.
horizontalScroll Provides relative horizontal movements from a scroll wheel or scroll ball.
orientation Indicates the direction of a stylus or finger relative to a surface.
hoverDistance Provides the distance that a finger or stylus is being held away from the touchscreen or touchpad.
hoverMajor Provides the length of the major axis of the stylus or finger that is about to touch the touchscreen or touchpad.
hoverMinor Provides the length of the minor axis of the stylus or finger that is about to touch the touchscreen or touchpad.
touchSize Provides the surface area that is in contact with the touchscreen or touchpad.
touchMajor Provides the length of the major axis of the stylus or finger that is in contact with the touchscreen or touchpad.
touchMinor Provides the length of the minor axis of the stylus or finger that is in contact with the touchscreen or touchpad.
pressure Provides the amount of pressure applied to the touchscreen or touchpad. Can be used by a mouse or trackball to indicate that a button was pressed.
tilt Provides the angle that a stylus is being held, relative to the surface.
generic1 Generic axis input 1. The data it provides is device-specific.
generic2 Generic axis input 2. The data it provides is device-specific.
generic3 Generic axis input 3. The data it provides is device-specific.
generic4 Generic axis input 4. The data it provides is device-specific.
generic5 Generic axis input 5. The data it provides is device-specific.
generic6 Generic axis input 6. The data it provides is device-specific.
generic7 Generic axis input 7. The data it provides is device-specific.
generic8 Generic axis input 8. The data it provides is device-specific.
generic9 Generic axis input 9. The data it provides is device-specific.
generic10 Generic axis input 10. The data it provides is device-specific.
generic11 Generic axis input 11. The data it provides is device-specific.
generic12 Generic axis input 12. The data it provides is device-specific.
generic13 Generic axis input 13. The data it provides is device-specific.
generic14 Generic axis input 14. The data it provides is device-specific.
generic15 Generic axis input 15. The data it provides is device-specific.
generic16 Generic axis input 16. The data it provides is device-specific.

Example

-- Fetch all input devices currently connected to the system
local inputDevices = system.getInputDevices()

-- Traverse all input devices
for deviceIndex = 1,#inputDevices do
    -- Fetch the input device's axes
    local inputAxes = inputDevices[deviceIndex]:getAxes()

    -- Print available axis type information
    for axisIndex = 1,#inputAxes do
        local inputAxis = inputAxes[axisIndex]
        print( inputAxis.descriptor .. ": " .. inputAxis.type )
    end
end