Lua Player

Function reference

You can use all Lua functions from http://www.lua.org and the following special PSP Lua Player functions for your script.lua:

int ctrlRead()

Return the current bitmask of the buttons. Use the isCtrl*-functions to check
which button is pressed.

boolean isCtrlSelect(int bitmask)

Return true, if the bit for the select key is set in the bitmask.

boolean isCtrlStart(int bitmask)

Return true, if the bit for the start key is set in the bitmask.

boolean isCtrlUp(int bitmask)

Return true, if the bit for the up key is set in the bitmask.

boolean isCtrlRight(int bitmask)

Return true, if the bit for the right key is set in the bitmask.

boolean isCtrlDown(int bitmask)

Return true, if the bit for the down key is set in the bitmask.

boolean isCtrlLeft(int bitmask)

Return true, if the bit for the left key is set in the bitmask.

boolean isCtrlUp(int bitmask)

Return true, if the bit for the up key is set in the bitmask.

boolean isCtrlLTrigger(int bitmask)

Return true, if the bit for the left trigger is set in the bitmask.

boolean isCtrlRTrigger(int bitmask)

Return true, if the bit for the right trigger is set in the bitmask.

boolean isCtrlTriangle(int bitmask)

Return true, if the bit for the triangle key is set in the bitmask.

boolean isCtrlCircle(int bitmask)

Return true, if the bit for the circle key is set in the bitmask.

boolean isCtrlCross(int bitmask)

Return true, if the bit for the cross key is set in the bitmask.

boolean isCtrlSquare(int bitmask)

Return true, if the bit for the square key is set in the bitmask.

boolean isCtrlHome(int bitmask)

Return true, if the bit for the home key is set in the bitmask.

boolean isCtrlHold(int bitmask)

Return true, if the bit for the hold key is set in the bitmask.

void waitVblankStart([int count])

Wait for next Vblank start. If you specify a count parameter, it waits multiple times for Vblank start. This can be used for delays, for example 60 for a one seconds delay.

int flipScreen()

Flip the current drawing offscreen with the display screen.

void blitImage(int x, int y, int imageHandle [, int destinationImageHandle])

Blit an image to screen or into another image, if destinationImageHandle is specified. Alpha channel is ignored.

void blitAlphaImage(int x, int y, int imageHandle [, int destinationImageHandle])

Blit an image to screen or into another image, if destinationImageHandle is specified.

void blitImageRect(int sx, int sy, int width, int height, int imageHandle, int dx, int dy [, int destinationImageHandle])

sx: left position of rectangle in source image
sy: top position of rectangle in source image
width: width of rectangle in source image
height: height of rectangle in source image
imageHandle: the source image
dx: left target position in destination image or screen
dy: top target position in destination image or screen
destinationImageHandle: destination image, if specified

Blit a part of an image to screen or into another image, if
destinationImageHandle is specified. Alpha channel is ignored.

void blitAlphaImageRect(int sx, int sy, int width, int height, int imageHandle, int dx, int dy [, int destinationImageHandle])

Same as blitImageRect, but with alpha channel.

void fillRect(int color, int x0, int y0, int width, int height [, int destinationImageHandle])

Fill a rectangle.

int createImage(int width, int height)

Create an empty image.

void clear(int color [, int imageHandle])

Clear an image or screen.

void screenshot(string filename)

Save a screenshot in the game directory in TGA format.

int loadImage(string filename)

Load an image in the game directory in PNG format.

getImageWidth(int imageHandle)

Get the width of an image.

getImageHeight(int imageHandle)

Get the height of an image.

void putPixel(int color, int x, int y [, int imageHandle)

Put a pixel on an image or on screen.

int getPixel(int x, int y [, int imageHandle)

Get the color of an pixel of an image or screen.

void printDecimal(int x, int y, int value, int color)

Print a decimal number as 7 segment.

void printText(int x, int y, string text, int color)

Print a text at the specified position

int getColorNumber(int r, int g, int b)

Return the color for using with putPixel, clear and fillRect (opaque is set for alpha)

table dir([path])

Return the entries of the current directory or of path, if specified, or nil,
if an error occured

string getCurrentDirectory()

Return the current directory.

void setCurrentDirectory(string path)

Change the current directory

void drawLine(int x0, int y0, int x1, int y1, int color [, int imageHandle])

Draw a line.