Gamepad Module
Contents
pressed
boolean gamepad.pressed(number gamepadId, number button)
If the given gamepad has had its button pressed since last polling, returns true. Else, false.
released
boolean gamepad.released(number gamepadId, number button)
If the given gamepad has had its button released since last polling, returns true. Else, false.
isDown
boolean gamepad.isDown(number gamepadId, number button)
If the given gamepad currently has a given button held down (as of last polling), returns true. Else, returns false.
getPOV
number gamepad.getPOV(number gamepadId)
Returns the angle of the POV hat (D-pad). If centered, returns JOY_POVCENTERED.
getAxis
number gamepad.getAxis(number gamepadId, number axisId)
Returns the axis value for a given gamepad. The value will be between 0 (minimum) and 100(maximum). If centered, the value will be ~50.
This will not always be exact! Due to calibration, floating-point inaccuracies, and physical defects, you may receive a value that is a fraction off the intended value. I.e. ~49-51 while centered.
getCount
number gamepad.getCount()
Returns the number of connected gamepads.