Fandom

Pico-8 Wiki

Stop

162pages on
this wiki
Add New Page
Comments0 Share
stop( )

Stops the program's execution and returns to the command prompt.

Undocumented feature
This article describes a feature that is not mentioned in the official Pico-8 documentation. The feature was known to work at the time the article was written, but it may be removed or changed in a future version.

The stop() function stops the program at the point where the function is called, returning to the command prompt. This is similar to pressing the Escape key at a specific point in the code.

If your program uses the game loop, you can resume execution of the program using the resume command. This does not resume from the call to stop(). Instead, it starts the next loop iteration with a call to _update(). If your program does not use the game loop, resume raises an error.

Examples Edit

v = 1

function _update()
  v += 1
  if (v % 5) == 0 then stop() end
end

function _draw()
  cls()
  print(v, 0, 0, 8)
end

Running this program stops when v is a multiple of 5. From the command prompt:

> print(v)
5
> resume

The program stops again at the next multiple of 5:

> print(v)
10

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.