run [str]
run( [str] )
run( [str] )
- Runs the current cartridge from the start of the program.
- str
-
- A "breadcrumb" string, as if passed by a calling cartridge.
When run as a system command at the PICO-8 prompt, this starts the program. If the program was running previously, run
resets the game state and starts from the beginning.
When run()
is called as a function, the runtime environment resets and the program executes from the beginning.
A string may be passed as a "breadcrumb" that the cartridge can find in stat(6)
. Breadcrumbs are usually used when one cartridge loads another and wishes to tell the other where it came from. This is a way to simulate that, or to retain the existing breadcrumb if the cartridge chooses to re-run itself.
Examples[]
At the PICO-8 prompt:
> run > run this is my breadcrumb > run "this is my breadcrumb"
Note that quotes are optional and both of the latter examples produce the same result.
In source code:
-- reset the program
run()
-- reset the program with a breadcrumb
run("this is my breadcrumb")
-- reset the program and preserve the current breadcrumb
run(stat(6))