LifeLua 21-08-2025
Documentation for LifeLua, a Lua interpreter for the PS Vita
Loading...
Searching...
No Matches
os

System dialogs, apps, battery, power & system information (extends Lua's os library) More...

Detailed Description

These functions are added to Lua's standard os library, so os.time(), os.date(), os.clock(), etc. still work like in normal Lua (see the Lua manual).

System dialogs

The dialog functions (os.keyboard(), os.message(), os.importphoto(), ...) show one of the PS Vita's own dialogs and wait until it's closed, then return the result. While a dialog is open your main loop doesn't run, so the screen behind it is empty. To draw something behind a dialog (or to update it, like a progress bar), define the dialog's callback function. It's called once per frame while that dialog is open:

Dialog function Callback function
os.keyboard() LifeLuaIMEDialog()
os.message() LifeLuaMessageDialog()
os.systemmessage() LifeLuaSystemMessageDialog()
os.errormessage() LifeLuaErrorCodeDialog()
os.progressmessage() LifeLuaProgressMessageDialog()
os.importphoto() LifeLuaPhotoImportDialog()
os.importvideo() LifeLuaVideoImportDialog()
os.photoreview() LifeLuaPhotoReviewDialog()
os.cameraimport() LifeLuaCameraImportDialog()

Don't call draw.swapbuffers() inside these callbacks, LifeLua does it for you.

function LifeLuaIMEDialog()
background:display(0, 0) -- keep the app's background visible behind the keyboard
end
local name = os.keyboard("What's your name?", "Harommel")
if name then
os.message("Hello, "..name.."!")
end

Shutter sound types

Used with os.shuttersound()

SceShutterSoundType SCE_SHUTTER_SOUND_TYPE_SAVE_IMAGE
 Photo shutter sound.
 
SceShutterSoundType SCE_SHUTTER_SOUND_TYPE_SAVE_VIDEO_START
 Video recording start sound.
 
SceShutterSoundType SCE_SHUTTER_SOUND_TYPE_SAVE_VIDEO_END
 Video recording end sound.
 

Shell lock types

Used with os.lock()

SceShellUtilLockType SCE_SHELL_UTIL_LOCK_TYPE_PS_BTN
 The PS button (pressing it can then be detected with SCE_CTRL_PSBUTTON)
 
SceShellUtilLockType SCE_SHELL_UTIL_LOCK_TYPE_QUICK_MENU
 The quick menu (holding the PS button)
 
SceShellUtilLockType SCE_SHELL_UTIL_LOCK_TYPE_POWEROFF_MENU
 The power off menu (holding the power button)
 
SceShellUtilLockType SCE_SHELL_UTIL_LOCK_TYPE_USB_CONNECTION
 USB connection.
 
SceShellUtilLockType SCE_SHELL_UTIL_LOCK_TYPE_MC_INSERTED
 Memory card inserted message.
 
SceShellUtilLockType SCE_SHELL_UTIL_LOCK_TYPE_MC_REMOVED
 Memory card removed message.
 
SceShellUtilLockType SCE_SHELL_UTIL_LOCK_TYPE_MUSIC_PLAYER
 Music player controls.
 
SceShellUtilLockType SCE_SHELL_UTIL_LOCK_TYPE_PS_BTN_2
 The PS button, without showing the "not allowed" symbol.
 
SceShellUtilLockType SCE_SHELL_UTIL_LOCK_TYPE_UNK8
 Unknown.
 
SceShellUtilLockType SCE_SHELL_UTIL_LOCK_TYPE_UNK80
 Unknown.
 
SceShellUtilLockType SCE_SHELL_UTIL_LOCK_TYPE_UNK100
 Unknown.
 
SceShellUtilLockType SCE_SHELL_UTIL_LOCK_TYPE_UNK200
 Unknown.
 

Info bar settings

Used with os.infobar(). Each one is also available without the SCE_APPMGR_ prefix (e.g. INFOBAR_COLOR_WHITE).

SceAppMgrInfoBarVisibility SCE_APPMGR_INFOBAR_VISIBILITY_INVISIBLE
 Hide the info bar.
 
SceAppMgrInfoBarVisibility SCE_APPMGR_INFOBAR_VISIBILITY_VISIBLE
 Show the info bar.
 
SceAppMgrInfoBarColor SCE_APPMGR_INFOBAR_COLOR_BLACK
 Black info bar.
 
SceAppMgrInfoBarColor SCE_APPMGR_INFOBAR_COLOR_WHITE
 White info bar.
 
SceAppMgrInfoBarTransparency SCE_APPMGR_INFOBAR_TRANSPARENCY_OPAQUE
 Solid info bar.
 
SceAppMgrInfoBarTransparency SCE_APPMGR_INFOBAR_TRANSPARENCY_TRANSLUCENT
 See-through info bar.
 

Keyboard types

Used in the type parameter of os.keyboard()

SceUInt32 SCE_IME_TYPE_DEFAULT
 Normal keyboard.
 
SceUInt32 SCE_IME_TYPE_BASIC_LATIN
 Basic latin letters only.
 
SceUInt32 SCE_IME_TYPE_NUMBER
 Number pad.
 
SceUInt32 SCE_IME_TYPE_EXTENDED_NUMBER
 Number pad with extra symbols.
 
SceUInt32 SCE_IME_TYPE_URL
 Keyboard for typing web addresses.
 
SceUInt32 SCE_IME_TYPE_MAIL
 Keyboard for typing e-mail addresses.
 

Keyboard text box modes

Used in the mode parameter of os.keyboard()

SceUInt32 SCE_IME_DIALOG_TEXTBOX_MODE_DEFAULT
 Normal text box.
 
SceUInt32 SCE_IME_DIALOG_TEXTBOX_MODE_PASSWORD
 Hides the typed text, for passwords.
 
SceUInt32 SCE_IME_DIALOG_TEXTBOX_MODE_WITH_CLEAR
 Text box with a clear button.
 

Keyboard options

Used in the option parameter of os.keyboard(). They can be added together.

SceUInt32 SCE_IME_OPTION_MULTILINE
 Allow several lines of text.
 
SceUInt32 SCE_IME_OPTION_NO_AUTO_CAPITALIZATION
 Don't capitalize the first letter automatically.
 
SceUInt32 SCE_IME_OPTION_NO_ASSISTANCE
 No word suggestions.
 

Keyboard dialog modes

Used in the dialog_mode parameter of os.keyboard()

SceUInt32 SCE_IME_DIALOG_DIALOG_MODE_DEFAULT
 Normal dialog.
 
SceUInt32 SCE_IME_DIALOG_DIALOG_MODE_WITH_CANCEL
 Dialog with a cancel button.
 

Keyboard enter labels

Used in the enter_label parameter of os.keyboard()

SceUInt32 SCE_IME_ENTER_LABEL_DEFAULT
 "Enter"
 
SceUInt32 SCE_IME_ENTER_LABEL_SEND
 "Send"
 
SceUInt32 SCE_IME_ENTER_LABEL_SEARCH
 "Search"
 
SceUInt32 SCE_IME_ENTER_LABEL_GO
 "Go"
 

Message dialog buttons

Used with os.message()

SceUInt32 SCE_MSG_DIALOG_BUTTON_TYPE_OK
 An OK button.
 
SceUInt32 SCE_MSG_DIALOG_BUTTON_TYPE_YESNO
 Yes and No buttons.
 
SceUInt32 SCE_MSG_DIALOG_BUTTON_TYPE_NONE
 No buttons (close it with os.closemessage())
 
SceUInt32 SCE_MSG_DIALOG_BUTTON_TYPE_OK_CANCEL
 OK and Cancel buttons.
 
SceUInt32 SCE_MSG_DIALOG_BUTTON_TYPE_CANCEL
 A Cancel button.
 
SceUInt32 SCE_MSG_DIALOG_BUTTON_TYPE_3BUTTONS
 3 buttons with your own text
 

Message dialog font sizes

Used for the button texts of os.message() with SCE_MSG_DIALOG_BUTTON_TYPE_3BUTTONS

SceUInt32 SCE_MSG_DIALOG_FONT_SIZE_DEFAULT
 Normal size.
 
SceUInt32 SCE_MSG_DIALOG_FONT_SIZE_SMALL
 Small size.
 

System message types

Used with os.systemmessage()

SceUInt32 SCE_MSG_DIALOG_SYSMSG_TYPE_WAIT
 "Please wait."
 
SceUInt32 SCE_MSG_DIALOG_SYSMSG_TYPE_WAIT_SMALL
 "Please wait." (small)
 
SceUInt32 SCE_MSG_DIALOG_SYSMSG_TYPE_WAIT_CANCEL
 "Please wait." with a cancel button
 
SceUInt32 SCE_MSG_DIALOG_SYSMSG_TYPE_NOSPACE
 Not enough free space.
 
SceUInt32 SCE_MSG_DIALOG_SYSMSG_TYPE_MAGNETIC_CALIBRATION
 Magnetometer calibration.
 
SceUInt32 SCE_MSG_DIALOG_SYSMSG_TYPE_NEED_MC_CONTINUE
 A memory card is needed to continue.
 
SceUInt32 SCE_MSG_DIALOG_SYSMSG_TYPE_NEED_MC_OPERATION
 A memory card is needed for this operation.
 
SceUInt32 SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_MIC_DISABLED
 The microphone is disabled.
 
SceUInt32 SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_WIFI_REQUIRED_OPERATION
 Wi-Fi is required for this operation.
 
SceUInt32 SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_WIFI_REQUIRED_APPLICATION
 Wi-Fi is required for this application.
 
SceUInt32 SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_EMPTY_STORE
 No content available in the store.
 

Power tick types

Used with os.powertick(), os.powerlock() and os.powerunlock()

SceKernelPowerTickType SCE_KERNEL_POWER_TICK_DEFAULT
 All the timers below.
 
SceKernelPowerTickType SCE_KERNEL_POWER_TICK_DISABLE_AUTO_SUSPEND
 The automatic sleep timer.
 
SceKernelPowerTickType SCE_KERNEL_POWER_TICK_DISABLE_OLED_OFF
 The screen-off timer.
 
SceKernelPowerTickType SCE_KERNEL_POWER_TICK_DISABLE_OLED_DIMMING
 The screen dimming timer.
 

System events

Returned by os.systemevent()

SceAppMgrSystemEventType SCE_APPMGR_SYSTEMEVENT_ON_RESUME
 The PS Vita woke up from sleep.
 
SceAppMgrSystemEventType SCE_APPMGR_SYSTEMEVENT_ON_STORE_PURCHASE
 A store purchase happened.
 
SceAppMgrSystemEventType SCE_APPMGR_SYSTEMEVENT_ON_NP_MESSAGE_ARRIVED
 A PSN message arrived.
 
SceAppMgrSystemEventType SCE_APPMGR_SYSTEMEVENT_ON_STORE_REDEMPTION
 A store code was redeemed.
 

Color space modes

Used with os.colorspace()

SceInt32 SCE_AVCONFIG_COLOR_SPACE_MODE_DEFAULT
 Normal colors.
 
SceInt32 SCE_AVCONFIG_COLOR_SPACE_MODE_HIGH_CONTRAST
 High contrast mode.
 

Languages

Returned by os.language()

SceSystemParamLang SCE_SYSTEM_PARAM_LANG_JAPANESE
 Japanese.
 
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_ENGLISH_US
 English (United States)
 
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_ENGLISH_GB
 English (United Kingdom)
 
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_FRENCH
 French.
 
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_SPANISH
 Spanish.
 
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_GERMAN
 German.
 
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_ITALIAN
 Italian.
 
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_DUTCH
 Dutch.
 
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_PORTUGUESE_PT
 Portuguese (Portugal)
 
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_PORTUGUESE_BR
 Portuguese (Brazil)
 
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_RUSSIAN
 Russian.
 
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_KOREAN
 Korean.
 
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_CHINESE_T
 Chinese (Traditional)
 
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_CHINESE_S
 Chinese (Simplified)
 
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_FINNISH
 Finnish.
 
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_SWEDISH
 Swedish.
 
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_DANISH
 Danish.
 
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_NORWEGIAN
 Norwegian.
 
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_POLISH
 Polish.
 
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_TURKISH
 Turkish.
 

Date & time formats

Returned by os.dateformat() and os.timeformat()

SceSystemParamDateFormat SCE_SYSTEM_PARAM_DATE_FORMAT_YYYYMMDD
 Year/Month/Day.
 
SceSystemParamDateFormat SCE_SYSTEM_PARAM_DATE_FORMAT_DDMMYYYY
 Day/Month/Year.
 
SceSystemParamDateFormat SCE_SYSTEM_PARAM_DATE_FORMAT_MMDDYYYY
 Month/Day/Year.
 
SceSystemParamTimeFormat SCE_SYSTEM_PARAM_TIME_FORMAT_12HR
 12-hour clock
 
SceSystemParamTimeFormat SCE_SYSTEM_PARAM_TIME_FORMAT_24HR
 24-hour clock
 

Dialogs

string os.keyboard (string title, string default_text, SceUInt32 type, SceUInt32 mode, SceUInt32 option, SceUInt32 dialog_mode, SceUInt32 enter_label, number length)
 
string os.ime (string title, string default_text, SceUInt32 type, SceUInt32 mode, SceUInt32 option, SceUInt32 dialog_mode, SceUInt32 enter_label, number length)
 
nil os.closeime ()
 
nil os.abortime ()
 
any os.message (string text, SceUInt32 buttons,...)
 
boolean os.systemmessage (SceUInt32 type)
 
boolean os.errormessage (number errorcode)
 
boolean os.progressmessage (string text)
 
nil os.progressmessagetext (string text)
 
nil os.setprogressmessage (number value)
 
nil os.incprogressmessage (number amount)
 
nil os.closemessage ()
 
nil os.abortmessage ()
 
string os.importphoto ()
 
nil os.abortphotoimport ()
 
string os.importvideo ()
 
nil os.abortimportvideo ()
 
nil os.photoreview (string path)
 
nil os.abortphotoreview ()
 
image os.cameraimport ()
 
nil os.abortcameraimport ()
 
nil os.notification (string text)
 

Apps

string os.title ()
 
string os.titleid ()
 
boolean os.appexists (string titleid)
 
nil os.appdelete (string titleid)
 
nil os.installdir (string path, boolean has_headbin)
 
nil os.installvpk (string path, boolean has_headbin)
 
table os.runningapps (number max)
 
nil os.closeapp (string titleid)
 
nil os.closeotherapps ()
 
nil os.uri (string uri, number flag)
 
nil os.execute (string path,...)
 
string os.launchparams ()
 
nil os.unmountmountpoint (string mountpoint)
 
nil os.requiremodule (string path)
 
nil os.exit ()
 

Timing

nil os.delay (number seconds)
 
nil os.delaycb (number seconds)
 

System UI

nil os.infobar (SceAppMgrInfoBarVisibility visibility, SceAppMgrInfoBarColor color, SceAppMgrInfoBarTransparency transparency)
 
nil os.lock (boolean lock, SceShellUtilLockType type,...)
 
nil os.shuttersound (SceShutterSoundType type)
 
SceAppMgrSystemEventType os.systemevent ()
 

Screenshots

nil os.screenshot (boolean enable)
 
nil os.screenshotoverlay (string path, number x, number y)
 
nil os.screenshotinfo (string photo_title, string game_title, string game_comment)
 
nil os.screenshotnotification (boolean enable)
 
nil os.screenshotcapture (number mode)
 

Exporting to system apps

boolean os.photoexport (string path)
 
boolean os.musicexport (string path)
 
boolean os.videoexport (string path)
 

Audio & display

number os.volume (number volume)
 
nil os.mute ()
 
nil os.acquirebgm (boolean acquire)
 
nil os.colorspace (SceInt32 mode)
 
nil os.displayon ()
 
nil os.displayoff ()
 

Power

nil os.restart ()
 
nil os.standby ()
 
nil os.suspend ()
 
nil os.shutdown ()
 
boolean os.suspendneeded ()
 
nil os.powertick (SceKernelPowerTickType type)
 
nil os.powerlock (SceKernelPowerTickType type)
 
nil os.powerunlock (SceKernelPowerTickType type)
 
number os.cpu (number mhz)
 
number os.bus (number mhz)
 
number os.gpu (number mhz)
 
number os.xbar (number mhz)
 

Battery

number os.batterypercent ()
 
boolean os.isbatterycharging ()
 
boolean os.isbatterylow ()
 
boolean os.externalbattery ()
 
number os.batterylifetime ()
 
number os.batterySOH ()
 
number os.batteryvoltage ()
 
number os.batterycyclecount ()
 
number os.batterytemperature ()
 
number os.batterycapacity ()
 
number os.remainingbatterycapacity ()
 

System information

string os.username ()
 
SceSystemParamLang os.language ()
 
SceSystemParamDateFormat os.dateformat ()
 
SceSystemParamTimeFormat os.timeformat ()
 
string os.realfirmware ()
 
string os.spoofedfirmware ()
 
string os.factoryfirmware ()
 
boolean os.unsafe ()
 
boolean os.isvita ()
 
boolean os.ispstv ()
 
boolean os.iscex ()
 
boolean os.isdex ()
 
boolean os.istool ()
 
boolean os.istest ()
 
any os.getregkey (string category, string name)
 
nil os.setregkey (string category, string name, any value, number size)
 

Function Documentation

◆ os.abortcameraimport()

nil os.abortcameraimport ( )

Aborts the camera dialog

◆ os.abortime()

nil os.abortime ( )

Aborts the keyboard dialog

◆ os.abortimportvideo()

nil os.abortimportvideo ( )

Aborts the video import dialog

◆ os.abortmessage()

nil os.abortmessage ( )

Aborts the open message dialog

◆ os.abortphotoimport()

nil os.abortphotoimport ( )

Aborts the photo import dialog

◆ os.abortphotoreview()

nil os.abortphotoreview ( )

Aborts the photo review dialog

◆ os.acquirebgm()

nil os.acquirebgm ( boolean acquire)

Takes or gives back the background music audio port

Parameters
acquiretrue to take it, false to give it back

◆ os.appdelete()

nil os.appdelete ( string titleid)

Uninstalls an app. Waits until it's done.

Parameters
titleidThe app's title ID

◆ os.appexists()

boolean os.appexists ( string titleid)

Checks if an app is installed

Parameters
titleidThe app's title ID
Returns
true if it's installed

◆ os.batterycapacity()

number os.batterycapacity ( )

Gets the battery's full capacity

Returns
Capacity in mAh

◆ os.batterycyclecount()

number os.batterycyclecount ( )

Gets how many times the battery has been fully charged

Returns
The number of charge cycles

◆ os.batterylifetime()

number os.batterylifetime ( )

Gets the estimated remaining battery time

Returns
Time in minutes

◆ os.batterypercent()

number os.batterypercent ( )

Gets the battery charge

Returns
The charge in percent (0-100)

◆ os.batterySOH()

number os.batterySOH ( )

Gets the battery's health (State Of Health)

Returns
Health in percent

◆ os.batterytemperature()

number os.batterytemperature ( )

Gets the battery temperature

Returns
Temperature in degrees Celsius

◆ os.batteryvoltage()

number os.batteryvoltage ( )

Gets the battery voltage

Returns
Voltage in millivolts

◆ os.bus()

number os.bus ( number mhz)

Gets or sets the bus clock speed

Parameters
mhzNew speed in MHz (optional)
Returns
The current speed in MHz if mhz is omitted

◆ os.cameraimport()

image os.cameraimport ( )

Opens the system's camera dialog so the user can take a photo

Returns
The photo as an image, or nil if the user canceled

◆ os.closeapp()

nil os.closeapp ( string titleid)

Closes a running app

Parameters
titleidThe app's title ID

◆ os.closeime()

nil os.closeime ( )

Closes the keyboard (the typed text is kept)

◆ os.closemessage()

nil os.closemessage ( )

Closes the open message dialog (like pressing its button)

◆ os.closeotherapps()

nil os.closeotherapps ( )

Closes all the other running apps

◆ os.colorspace()

nil os.colorspace ( SceInt32 mode)

Sets the screen's color mode

Parameters
modeOne of the color space mode constants (optional, default: SCE_AVCONFIG_COLOR_SPACE_MODE_DEFAULT)

◆ os.cpu()

number os.cpu ( number mhz)

Gets or sets the CPU clock speed

Parameters
mhzNew speed in MHz (e.g. 333 or 444) (optional)
Returns
The current speed in MHz if mhz is omitted

◆ os.dateformat()

SceSystemParamDateFormat os.dateformat ( )

Gets the system's date format

Returns
One of the date format constants

◆ os.delay()

nil os.delay ( number seconds)

Pauses the app for some time

Parameters
secondsHow long to wait, in seconds (decimals allowed) (optional, default: 0)

◆ os.delaycb()

nil os.delaycb ( number seconds)

Pauses the app for some time, while letting system callbacks run

Parameters
secondsHow long to wait, in seconds (decimals allowed) (optional, default: 0)

◆ os.displayoff()

nil os.displayoff ( )

Turns the screen off (the app keeps running)

◆ os.displayon()

nil os.displayon ( )

Turns the screen on

◆ os.errormessage()

boolean os.errormessage ( number errorcode)

Shows the system's error message for an error code (like C1-2345-6) and waits until it's closed

Parameters
errorcodeThe error code number (e.g. 0x80010002)
Returns
false if the user chose "No", otherwise true

◆ os.execute()

nil os.execute ( string path,
... )

Starts another program (eboot.bin/SELF) in place of your app

Parameters
pathPath of the SELF, it must be inside the app's partition (app0:)
...Strings passed to the program as its arguments (optional)

◆ os.exit()

nil os.exit ( )

Exits the app (standard Lua function)

◆ os.externalbattery()

boolean os.externalbattery ( )

Checks if a charger is connected

Returns
true if the PS Vita is plugged in

◆ os.factoryfirmware()

string os.factoryfirmware ( )

Gets the firmware version the PS Vita came with from the factory

Returns
The version, e.g. "3.60"

◆ os.getregkey()

any os.getregkey ( string category,
string name )

Reads a system registry key

Parameters
categoryThe key's category (e.g. "/CONFIG/SYSTEM/")
nameThe key's name (e.g. "username")
Returns
The value (a string or number), or nil if the key can't be read

◆ os.gpu()

number os.gpu ( number mhz)

Gets or sets the GPU clock speed

Parameters
mhzNew speed in MHz (optional)
Returns
The current speed in MHz if mhz is omitted

◆ os.ime()

string os.ime ( string title,
string default_text,
SceUInt32 type,
SceUInt32 mode,
SceUInt32 option,
SceUInt32 dialog_mode,
SceUInt32 enter_label,
number length )

Same as os.keyboard()

Parameters
titleTitle shown above the text box
default_textText already in the text box (optional)
typeOne of the keyboard type constants (optional)
modeOne of the text box mode constants (optional)
optionKeyboard option constants, added together (optional)
dialog_modeOne of the dialog mode constants (optional)
enter_labelOne of the enter label constants (optional)
lengthMaximum number of characters (optional)
Returns
The typed text, or nil if the user canceled

◆ os.importphoto()

string os.importphoto ( )

Lets the user pick a photo from the Photos app

Returns
The path of the chosen photo, or nil if the user canceled
Example:
local path = os.importphoto()
if path then picture = image.load(path) end

◆ os.importvideo()

string os.importvideo ( )

Lets the user pick a video from the Videos app

Returns
The path of the chosen video, or nil if the user canceled

◆ os.incprogressmessage()

nil os.incprogressmessage ( number amount)

Increases the value of the open progress message's bar

Parameters
amountHow much to add

◆ os.infobar()

nil os.infobar ( SceAppMgrInfoBarVisibility visibility,
SceAppMgrInfoBarColor color,
SceAppMgrInfoBarTransparency transparency )

Shows, hides or changes the info bar (the bar at the top of the screen with the clock and battery)

Parameters
visibilitySCE_APPMGR_INFOBAR_VISIBILITY_VISIBLE or SCE_APPMGR_INFOBAR_VISIBILITY_INVISIBLE (optional, default: invisible)
colorSCE_APPMGR_INFOBAR_COLOR_BLACK or SCE_APPMGR_INFOBAR_COLOR_WHITE (optional, default: black)
transparencySCE_APPMGR_INFOBAR_TRANSPARENCY_OPAQUE or SCE_APPMGR_INFOBAR_TRANSPARENCY_TRANSLUCENT (optional, default: opaque)
Example:
os.infobar(INFOBAR_VISIBILITY_VISIBLE, INFOBAR_COLOR_WHITE, INFOBAR_TRANSPARENCY_TRANSLUCENT)

◆ os.installdir()

nil os.installdir ( string path,
boolean has_headbin )

Installs an app from a folder (the extracted contents of a .VPK). Waits until it's done.

Parameters
pathPath of the folder
has_headbintrue if the folder already has a sce_sys/package/head.bin, false to have one made (optional, default: false)

◆ os.installvpk()

nil os.installvpk ( string path,
boolean has_headbin )

Installs a .VPK file. It's extracted to ux0:data/ll_temp first, then installed with os.installdir().

Parameters
pathPath of the .VPK
has_headbintrue if the .VPK already has a sce_sys/package/head.bin (optional, default: false)

◆ os.isbatterycharging()

boolean os.isbatterycharging ( )

Checks if the battery is charging

Returns
true if it's charging

◆ os.isbatterylow()

boolean os.isbatterylow ( )

Checks if the battery is low

Returns
true if it's low

◆ os.iscex()

boolean os.iscex ( )

Checks if the console is a retail (CEX) unit

Returns
true on a retail unit

◆ os.isdex()

boolean os.isdex ( )

Checks if the console is a debug/testing (DEX) unit

Returns
true on a DEX unit

◆ os.ispstv()

boolean os.ispstv ( )

Checks if the console is a PS TV

Returns
true on a PS TV

◆ os.istest()

boolean os.istest ( )

Checks if the console is a test unit

Returns
true on a test unit

◆ os.istool()

boolean os.istool ( )

Checks if the console is a development kit (TOOL)

Returns
true on a development kit

◆ os.isvita()

boolean os.isvita ( )

Checks if the console is a PS Vita handheld

Returns
true on a PS Vita

◆ os.keyboard()

string os.keyboard ( string title,
string default_text,
SceUInt32 type,
SceUInt32 mode,
SceUInt32 option,
SceUInt32 dialog_mode,
SceUInt32 enter_label,
number length )

Shows the system keyboard and waits for the user to type something.

os.ime() is the same function under another name.

Parameters
titleTitle shown above the text box
default_textText already in the text box (optional, default: empty)
typeOne of the keyboard type constants (optional, default: SCE_IME_TYPE_DEFAULT)
modeOne of the text box mode constants (optional, default: SCE_IME_DIALOG_TEXTBOX_MODE_DEFAULT)
optionKeyboard option constants, added together (optional, default: none)
dialog_modeOne of the dialog mode constants (optional, default: SCE_IME_DIALOG_DIALOG_MODE_DEFAULT)
enter_labelOne of the enter label constants (optional, default: SCE_IME_ENTER_LABEL_DEFAULT)
lengthMaximum number of characters (optional, default: the system maximum)
Returns
The typed text, or nil if the user canceled
Example:
local pin = os.keyboard("Enter your PIN", "", SCE_IME_TYPE_NUMBER, SCE_IME_DIALOG_TEXTBOX_MODE_PASSWORD)
SceUInt32 SCE_IME_DIALOG_TEXTBOX_MODE_PASSWORD
Hides the typed text, for passwords.
Definition lj_os.h:690
SceUInt32 SCE_IME_TYPE_NUMBER
Number pad.
Definition lj_os.h:681

◆ os.language()

SceSystemParamLang os.language ( )

Gets the system language

Returns
One of the language constants
Example:
local greeting = "Hello"
if os.language() == SCE_SYSTEM_PARAM_LANG_FRENCH then greeting = "Bonjour" end
SceSystemParamLang SCE_SYSTEM_PARAM_LANG_FRENCH
French.
Definition lj_os.h:773

◆ os.launchparams()

string os.launchparams ( )

Gets the parameters your app was launched with (e.g. from a URI)

Returns
The parameters as a string

◆ os.lock()

nil os.lock ( boolean lock,
SceShellUtilLockType type,
... )

Blocks or unblocks system features, like the PS button or the quick menu

Parameters
locktrue to block, false to unblock
typeOne or more shell lock type constants, as separate parameters
...More shell lock type constants
Example:
-- ...
SceShellUtilLockType SCE_SHELL_UTIL_LOCK_TYPE_PS_BTN
The PS button (pressing it can then be detected with SCE_CTRL_PSBUTTON)
Definition lj_os.h:653
SceShellUtilLockType SCE_SHELL_UTIL_LOCK_TYPE_QUICK_MENU
The quick menu (holding the PS button)
Definition lj_os.h:654

◆ os.message()

any os.message ( string text,
SceUInt32 buttons,
... )

Shows a message dialog and waits until it's closed

With SCE_MSG_DIALOG_BUTTON_TYPE_3BUTTONS, 6 more parameters are required: the text and font size of each button.

Parameters
textThe message
buttonsOne of the message dialog button constants (optional, default: SCE_MSG_DIALOG_BUTTON_TYPE_OK)
...The 3 button texts and font sizes, only for SCE_MSG_DIALOG_BUTTON_TYPE_3BUTTONS
Returns
false if the user chose "No" (or the dialog was invalid), otherwise true. With 3 buttons: the text of the chosen button, or nil if none was chosen.
Example:
if os.message("Delete the save file?", SCE_MSG_DIALOG_BUTTON_TYPE_YESNO) then
io.delete("ux0:data/myapp/save.txt")
end
local level = os.message("Choose a difficulty", SCE_MSG_DIALOG_BUTTON_TYPE_3BUTTONS, "Easy", size, "Normal", size, "Hard", size)
-- level is "Easy", "Normal" or "Hard"
SceUInt32 SCE_MSG_DIALOG_FONT_SIZE_DEFAULT
Normal size.
Definition lj_os.h:727
SceUInt32 SCE_MSG_DIALOG_BUTTON_TYPE_3BUTTONS
3 buttons with your own text
Definition lj_os.h:722
SceUInt32 SCE_MSG_DIALOG_BUTTON_TYPE_YESNO
Yes and No buttons.
Definition lj_os.h:718

◆ os.musicexport()

boolean os.musicexport ( string path)

Copies a song into the Music app

Parameters
pathPath of the song (.MP3)
Returns
true on success

◆ os.mute()

nil os.mute ( )

Mutes the PS Vita

◆ os.notification()

nil os.notification ( string text)

Shows a notification (the kind that slides in from the top of the screen)

Parameters
textThe notification text

◆ os.photoexport()

boolean os.photoexport ( string path)

Copies a photo into the Photos app

Parameters
pathPath of the photo (.PNG, .JPG/.JPEG, .BMP)
Returns
true on success

◆ os.photoreview()

nil os.photoreview ( string path)

Opens a photo in the system's photo viewer

Parameters
pathPath of the photo

◆ os.powerlock()

nil os.powerlock ( SceKernelPowerTickType type)

Prevents the PS Vita from going to sleep until os.powerunlock() is called

Parameters
typeOne of the power tick type constants (optional, default: SCE_KERNEL_POWER_TICK_DEFAULT)

◆ os.powertick()

nil os.powertick ( SceKernelPowerTickType type)

Resets power timers, so the screen doesn't dim/turn off and the PS Vita doesn't fall asleep. Call it regularly (e.g. once per frame) while you want to keep the PS Vita awake, like during a video.

Parameters
typeOne of the power tick type constants (optional, default: SCE_KERNEL_POWER_TICK_DEFAULT)

◆ os.powerunlock()

nil os.powerunlock ( SceKernelPowerTickType type)

Allows the PS Vita to go to sleep again after os.powerlock()

Parameters
typeOne of the power tick type constants (optional, default: SCE_KERNEL_POWER_TICK_DEFAULT)

◆ os.progressmessage()

boolean os.progressmessage ( string text)

Shows a message with a progress bar and waits until it's closed. Because this waits, the progress bar is updated from the LifeLuaProgressMessageDialog() callback, using os.setprogressmessage(), os.incprogressmessage() and os.progressmessagetext(), then closed with os.closemessage().

Parameters
textThe message
Returns
true when it's closed
Example:
local progress = 0
function LifeLuaProgressMessageDialog()
progress = progress + 1
os.setprogressmessage(progress)
if progress >= 100 then os.closemessage() end
end
os.progressmessage("Loading...")

◆ os.progressmessagetext()

nil os.progressmessagetext ( string text)

Changes the text of the open progress message

Parameters
textThe new text

◆ os.realfirmware()

string os.realfirmware ( )

Gets the real firmware version

Returns
The version, e.g. "3.65"

◆ os.remainingbatterycapacity()

number os.remainingbatterycapacity ( )

Gets the battery's remaining capacity

Returns
Remaining capacity in mAh

◆ os.requiremodule()

nil os.requiremodule ( string path)

Loads and starts a user module (.SUPRX), giving it the Lua state so it can add its own Lua functions

Parameters
pathPath of the module

◆ os.restart()

nil os.restart ( )

Restarts the PS Vita

◆ os.runningapps()

table os.runningapps ( number max)

Gets the title IDs of the apps that are running

Parameters
maxMaximum number of apps to list (optional, default: 100)
Returns
A list of title IDs

◆ os.screenshot()

nil os.screenshot ( boolean enable)

Allows or blocks taking screenshots (PS button + Start) in your app

Parameters
enabletrue to allow, false to block

◆ os.screenshotcapture()

nil os.screenshotcapture ( number mode)

Takes a screenshot and saves it to the Photos app, like pressing PS button + Start

Parameters
mode0 for a normal screenshot, 1 to take it even if screenshots are blocked (optional, default: 1)

◆ os.screenshotinfo()

nil os.screenshotinfo ( string photo_title,
string game_title,
string game_comment )

Sets the information saved with screenshots taken in your app

Parameters
photo_titleTitle of the photo (optional)
game_titleTitle of the game (optional)
game_commentA comment (optional)

◆ os.screenshotnotification()

nil os.screenshotnotification ( boolean enable)

Shows or hides the notification that appears after taking a screenshot

Parameters
enabletrue to show it, false to hide it

◆ os.screenshotoverlay()

nil os.screenshotoverlay ( string path,
number x,
number y )

Sets an image that's drawn over every screenshot taken in your app, like a watermark

Parameters
pathPath of the image (.PNG)
xX position of the image (optional, default: 0)
yY position of the image (optional, default: 0)

◆ os.setprogressmessage()

nil os.setprogressmessage ( number value)

Sets the value of the open progress message's bar

Parameters
valueProgress from 0 to 100

◆ os.setregkey()

nil os.setregkey ( string category,
string name,
any value,
number size )

Writes a system registry key

Warning
Wrong registry values can break system settings. Only change keys you know.
Parameters
categoryThe key's category
nameThe key's name
valueThe new value, a number or a string
sizeSize of a string/binary value in bytes (optional, default: the length of value)

◆ os.shutdown()

nil os.shutdown ( )

Same as os.suspend(): puts the PS Vita to sleep. Use os.standby() to turn it off.

◆ os.shuttersound()

nil os.shuttersound ( SceShutterSoundType type)

Plays the camera shutter sound

Parameters
typeOne of the shutter sound type constants

◆ os.spoofedfirmware()

string os.spoofedfirmware ( )

Gets the firmware version the system reports (it can be spoofed by plugins)

Returns
The version, e.g. "3.74"

◆ os.standby()

nil os.standby ( )

Turns the PS Vita off

◆ os.suspend()

nil os.suspend ( )

Puts the PS Vita to sleep (rest mode)

◆ os.suspendneeded()

boolean os.suspendneeded ( )

Checks if the system wants the app to let the PS Vita go to sleep

Returns
true if a sleep is needed

◆ os.systemevent()

SceAppMgrSystemEventType os.systemevent ( )

Gets the next system event, like waking up from sleep

Returns
One of the system event constants

◆ os.systemmessage()

boolean os.systemmessage ( SceUInt32 type)

Shows one of the system's built-in messages and waits until it's closed

Parameters
typeOne of the system message type constants
Returns
false if the user chose "No", otherwise true

◆ os.timeformat()

SceSystemParamTimeFormat os.timeformat ( )

Gets the system's time format

Returns
One of the time format constants

◆ os.title()

string os.title ( )

Gets your app's title (as shown in the LiveArea)

Returns
The title

◆ os.titleid()

string os.titleid ( )

Gets your app's title ID

Returns
The title ID, e.g. "LIFELUAJT"

◆ os.unmountmountpoint()

nil os.unmountmountpoint ( string mountpoint)

Unmounts a mount point

Parameters
mountpointThe mount point

◆ os.unsafe()

boolean os.unsafe ( )

Checks if the app is running in unsafe mode (enabled in HENkaku's settings), which is needed for some features

Returns
true if unsafe mode is on

◆ os.uri()

nil os.uri ( string uri,
number flag )

Opens a URI, which can launch other apps or open a website in the browser

Parameters
uriThe URI (e.g. "psgm:play?titleid=VITASHELL" or "https://example.com")
flagLaunch flags (optional, default: 0xFFFFF)

◆ os.username()

string os.username ( )

Gets the PSN/system user name

Returns
The user name

◆ os.videoexport()

boolean os.videoexport ( string path)

Copies a video into the Videos app

Parameters
pathPath of the video (.MP4)
Returns
true on success

◆ os.volume()

number os.volume ( number volume)

Gets or sets the system volume

Parameters
volumeNew volume, from 0 to 30 (optional)
Returns
The current volume (0-30) if volume is omitted

◆ os.xbar()

number os.xbar ( number mhz)

Gets or sets the GPU crossbar (XBAR) clock speed

Parameters
mhzNew speed in MHz (optional)
Returns
The current speed in MHz if mhz is omitted