Skip to content

Quick Start

OpenLua Bot edited this page Nov 11, 2026 · 1 revision

Quick Start

This page gets a minimal script running on a PSP or in PPSSPP.

1. Deploy the engine

Follow Installation. You need at least:

PSP/GAME/OpenLua/EBOOT.PBP
PSP/GAME/OpenLua/script.lua
PSP/GAME/OpenLua/assets/        (if your script loads assets)

2. Write script.lua

OpenLua runs exactly one script: script.lua in the app directory. A minimal frame loop looks like this:

local bg   = color.new(16, 24, 48)
local red  = color.new(255, 0, 0)
local font = font.new("assets/font.png", 8, 16)

screen.font(font)

while true do
    screen.clear(bg)
    draw.fillrect(20, 20, 120, 4, red)
    screen.print(20, 40, "Hello PSP")
    screen.flip()
end

Important points:

  • screen.flip() presents the frame and pumps audio and timing. A loop without it will not display anything properly.
  • color.new(r, g, b) builds a color value.
  • font.new(path, cellW, cellH) loads a fixed-cell PNG sheet. If you omit a font, the engine uses its built-in 5x7 font.
  • Paths are relative to the app directory, not to the script file.

3. Add assets

Copy the assets/ folder from the repository next to EBOOT.PBP. The example uses assets/font.png.

4. Run it

  • PSP: launch OpenLua from the Game menu.
  • PPSSPP: open EBOOT.PBP or point PPSSPP at the app folder. Use a desktop GPU backend; software rendering can be slow or unstable.

5. Read input

local pad = buttons.read()

if pad & buttons.CROSS then
    -- X is held
end
if pad & buttons.CIRCLE then
    -- O is held
end

See API Reference → buttons for the full mask list.

6. Use images

local img = image.load("assets/test_sheet.png", 64, 64)

image.reset(img)
image.blitsprite(img, 60, 80, 0)
image.fliph(img, true)
image.blitsprite(img, 140, 80, 1)

Image functions work both as module calls (image.getw(img)) and as methods (img:getw()).

Fonts on a real PSP

  • font.new(path, cellW, cellH) + PNG sheet: works everywhere.
  • sfont.load(path): works everywhere.
  • font.load("flash0:/font/ltn0.pgf"): returns nil in the standard PSP build. PGF support is present in host and opt-in builds only, because sceLibFont is a per-game user module on real firmware. See Troubleshooting → PGF.

For new projects, bundle a PNG font or use the built-in font.

Next steps

Clone this wiki locally