Ls

From Pico-8 Wiki
(Redirected from Dir)
Jump to navigation Jump to search
ls
Lists the files in the current working directory of the cartridge storage area.
dir
Alias for ls.

You execute this system command at the PICO-8 prompt.

Unlike the ls command of some operating systems, this command does not take arguments. To see the contents of a directory (folder) in the cartridge storage area, first use the cd command to change the current working directory, then use ls.

The dir command is an alias for this command.

This command can also be used by a program as a function: ls() The return value is a table of filenames. This returns the names of files only, and does not return subdirectories.

Examples

At the command prompt:

> cd demos
> ls

In code:

-- get the list of files
files = ls()

See also