LifeLua 30-05-2025
Documentation for LifeLua
Loading...
Searching...
No Matches
controls

Controls, touch & motion. More...

Functions

nil controls.update (boolean ext, boolean bind)
 
boolean controls.pressed (SceCtrlButtons button)
 
boolean controls.held (SceCtrlButtons button)
 
boolean controls.released (SceCtrlButtons button)
 
boolean controls.check (SceCtrlButtons button)
 
nil controls.check (number min, number max, number port)
 
nil controls.check (number r, number g, number b, number port)
 
number controls.leftanalog ()
 
number controls.rightanalog ()
 
number controls.accelerometer ()
 
number controls.gyroscope ()
 
number controls.fronttouch ()
 
number controls.reartouch ()
 
nil controls.lightbar (number r, number g, number b)
 
nil controls.vibrate (number small, number large, number port)
 

Variables

SceCtrlButtons SCE_CTRL_SELECT
 
SceCtrlButtons SCE_CTRL_L3
 
SceCtrlButtons SCE_CTRL_R3
 
SceCtrlButtons SCE_CTRL_START
 
SceCtrlButtons SCE_CTRL_UP
 
SceCtrlButtons SCE_CTRL_RIGHT
 
SceCtrlButtons SCE_CTRL_DOWN
 
SceCtrlButtons SCE_CTRL_LEFT
 
SceCtrlButtons SCE_CTRL_LTRIGGER
 
SceCtrlButtons SCE_CTRL_L2
 
SceCtrlButtons SCE_CTRL_RTRIGGER
 
SceCtrlButtons SCE_CTRL_R2
 
SceCtrlButtons SCE_CTRL_L1
 
SceCtrlButtons SCE_CTRL_R1
 
SceCtrlButtons SCE_CTRL_TRIANGLE
 
SceCtrlButtons SCE_CTRL_CIRCLE
 
SceCtrlButtons SCE_CTRL_CROSS
 
SceCtrlButtons SCE_CTRL_SQUARE
 
SceCtrlButtons SCE_CTRL_INTERCEPTED
 
SceCtrlButtons SCE_CTRL_PSBUTTON
 
SceCtrlButtons SCE_CTRL_HEADPHONE
 
SceCtrlButtons SCE_CTRL_VOLUP
 
SceCtrlButtons SCE_CTRL_VOLDOWN
 
SceCtrlButtons SCE_CTRL_POWER
 
SceCtrlButtons SCE_CTRL_ACCEPT
 
SceCtrlButtons SCE_CTRL_CANCEL
 

Detailed Description

Controls, touch & motion

Function Documentation

◆ controls.accelerometer()

number controls.accelerometer ( )

Accelerometer input

Example:
acc = controls.accelerometer()
-- acc.x, acc.y, acc.z
Returns
A table with the X, Y and Z of the accelerometer

◆ controls.check() [1/3]

nil controls.check ( number min,
number max,
number port )

Sets the vibration intensity on a DualShock controller

Parameters
portOptional

◆ controls.check() [2/3]

nil controls.check ( number r,
number g,
number b,
number port )

Sets the light bar color on a DualShock 4 controller

Parameters
portOptional

◆ controls.check() [3/3]

boolean controls.check ( SceCtrlButtons button)

Checks if a button was triggered

◆ controls.fronttouch()

number controls.fronttouch ( )

Front touch pad input

Example:
touch = controls.fronttouch()
-- touch[1].x, touch[1].y, touch[1].force, touch[1].id
-- touch[2].x, touch[2].y, touch[2].force, touch[2].id
-- index will increase if more fingers are touching the screen...
Returns
Tables with the X, Y, force and ID of the touch

◆ controls.gyroscope()

number controls.gyroscope ( )

Gyroscope input

Example:
gyro = controls.gyroscope()
-- gyro.x, gyro.y, gyro.z
Returns
A table with the X, Y and Z of the gyroscope

◆ controls.held()

boolean controls.held ( SceCtrlButtons button)

Checks if a button has been held

◆ controls.leftanalog()

number controls.leftanalog ( )

Left analog stick input

Example:
lx, ly = controls.leftanalog()
Returns
X and Y of the left analog stick, as 2 values

◆ controls.lightbar()

nil controls.lightbar ( number r,
number g,
number b )

Sets the lightbar on DualShock 4s

◆ controls.pressed()

boolean controls.pressed ( SceCtrlButtons button)

Checks if a button has been pressed

◆ controls.reartouch()

number controls.reartouch ( )

Rear touch pad input

Example:
touch = controls.reartouch()
-- touch[1].x, touch[1].y, touch[1].force, touch[1].id
-- touch[2].x, touch[2].y, touch[2].force, touch[2].id
-- index will increase if more fingers are touching the rear touch pad...
Returns
Tables with the X, Y, force and ID of the touch

◆ controls.released()

boolean controls.released ( SceCtrlButtons button)

Checks if a button has been released

◆ controls.rightanalog()

number controls.rightanalog ( )

Right analog stick input

Example:
rx, ry = controls.rightanalog()
Returns
X and Y of the Right analog stick, as 2 values

◆ controls.update()

nil controls.update ( boolean ext,
boolean bind )

Updates the controls

Parameters
extExtended controls, will update even if there are common dialogs running (IME keyboard, message etc.), optional
bindBinds the LTRIGGER & RTRIGGER to L1 & R1 respectively, optional

◆ controls.vibrate()

nil controls.vibrate ( number small,
number large,
number port )

Sets the vibration intensity on DualShock controllers

Parameters
portoptional