Skip to content

class Pads


methods


Pads.get


function Pads.get(port: integer) -> ret integer

@param port - which port to check

@return ret - currently pressed buttons

Gets the currently pressed buttons for a specific port

@see Pads.check

Pads.getLeftStick


function Pads.getLeftStick()
 -> X integer
 -> Y integer

@return X - the X axis value

@return Y - the Y axis value if no parameter passed, port 0 is assumed

gets the position of the left stick as coordinates

Pads.getRightStick


function Pads.getRightStick()
 -> X integer
 -> Y integer

@return X - the X axis value

@return Y - the Y axis value if no parameter passed, port 0 is assumed

gets the position of the Right stick as coordinates

Pads.getType


function Pads.getType(port: integer) -> T padtypes {
    PAD_TYPE_NEJICON = 2,
    PAD_TYPE_KONAMIGUN = 3,
    PAD_TYPE_DIGITAL = 4,
    PAD_TYPE_ANALOG = 5,
    PAD_TYPE_NAMCOGUN = 6,
    PAD_TYPE_DUALSHOCK = 7,
    PAD_TYPE_JOGCON = 14,
    PAD_TYPE_EX_TSURICON = 256,
    PAD_TYPE_EX_JOGCON = 768,
}

@param port - which port to check

gets what kind of controller is plugged into this port

@see padtypes

Pads.getPressure


function Pads.getPressure(
  port: integer,
  pad: padbuttons {
    PAD_LEFT = 128,
    PAD_DOWN = 64,
    PAD_RIGHT = 32,
    PAD_UP = 16,
    PAD_START = 8,
    PAD_R3 = 4,
    PAD_L3 = 2,
    PAD_SELECT = 1,
    PAD_SQUARE = 32768,
    PAD_CROSS = 16384,
    PAD_CIRCLE = 8192,
    PAD_TRIANGLE = 4096,
    PAD_R1 = 2048,
    PAD_L1 = 1024,
    PAD_R2 = 512,
    PAD_L2 = 256,
}
) -> pressure integer

@param port - which port to check

@param pad - wich button to check the pressure

Checks the pressure at which a specific button is being pressed

Pads.rumble


function Pads.rumble(
  port: integer,
  big: integer,
  small: integer
)

@param port - which port to check

@param big - big rumble control

@param small - small rumble control if not specifying port, port 0 is assumed

control joystick rumble

Pads.setLED


function Pads.setLED(
  port: integer,
  R: integer,
  G: integer,
  B: integer
)

@param port - which USB port to check: (SLIM: left port is 0, FAT: top port is 0)

@param R - RED color, any value between 0-255

@param G - GREEN color, any value between 0-255

@param B - BLUE color, any value between 0-255

Attempts to change the led color of a PS4 controller
if not specifying port, port 0 is assumed

Pads.check


function Pads.check(
  port: integer,
  pad: padbuttons {
    PAD_LEFT = 128,
    PAD_DOWN = 64,
    PAD_RIGHT = 32,
    PAD_UP = 16,
    PAD_START = 8,
    PAD_R3 = 4,
    PAD_L3 = 2,
    PAD_SELECT = 1,
    PAD_SQUARE = 32768,
    PAD_CROSS = 16384,
    PAD_CIRCLE = 8192,
    PAD_TRIANGLE = 4096,
    PAD_R1 = 2048,
    PAD_L1 = 1024,
    PAD_R2 = 512,
    PAD_L2 = 256,
}
)

@param port - which port to check

@param pad - wich buttons to check, you can combine with like this: PAD_START|PAD_R1

checks if the following button(s) is/are pressed