This is a list of functions provided by PICO-8's Lua-based API .

Typically you run these functions by writing them in the code editor and using the Run command to run your program. You can also call API functions from the PICO-8 command prompt.

Calling functions[edit | edit source]

Some functions have optional arguments, indicated in this guide by square brackets around the argument name. To specify a value for an optional argument, you must specify values for all other arguments to the left in the argument list.

For example, the spr() function has three required arguments and four optional arguments:

spr( n, x, y, [w,] [h,] [flip_x,] [flip_y] )

This function can be called with three arguments, accepting the defaults for the others:

spr(1, 60, 60)

To specify a value for the flip_x argument, you must also specify w and h, even if you're using their default values:

spr(1, 60, 60, 1, 1, true)

The game loop[edit | edit source]

If you define these functions in your code, PICO-8 will call them at specific times. See Game loop.

If your code doesn't use the game loop, you can call this function to copy the graphics buffer to the screen:

Graphics[edit | edit source]

See also Graphics.

Tables[edit | edit source]

See also Lua, Tables.

Input[edit | edit source]

Sound[edit | edit source]

Map[edit | edit source]

Memory[edit | edit source]

Math[edit | edit source]

See also Math.

Cartridge data[edit | edit source]

Coroutines[edit | edit source]

Values and objects[edit | edit source]

See also Lua, Strings, Tables, Metatables.

Time[edit | edit source]

System[edit | edit source]

Debugging[edit | edit source]

See also[edit | edit source]

Community content is available under CC-BY-SA unless otherwise noted.