Fandom

Pico-8 Wiki

APIReference

162pages on
this wiki
Add New Page
Comments0 Share

An API function is a function provided by Pico-8's API that you can call from a cartridge's source code. You can also call API functions from the Pico-8 command prompt.

Calling functions Edit

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

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

Tables Edit

See also Lua, Tables.

Input Edit

Sound Edit

Map Edit

Memory Edit

Math Edit

See also Math.

Cartridge data Edit

Coroutines Edit

Values and objects Edit

See also Lua, Strings, Tables, Metatables.

Time Edit

System Edit

Debugging Edit

See also Edit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.