APEX docs
Reference

Filesystem

Read and write files in the workspace folder.

appendfile

Also available as append_file

Adds text to the end of a file in the workspace folder, creating it if needed.

function appendfile(path: string, contents: string): ()

deletefile

Also available as delfile del_file

Deletes a file from the workspace.

function delfile(path: string): ()

deletefolder

Also available as delfolder del_folder

Deletes a folder and everything inside it.

function delfolder(path: string): ()

dofile

Also available as do_file

Reads a Lua file from the workspace and runs it, returning whatever it returns.

getcustomasset

Also available as getsynasset get_custom_asset

Turns a workspace file into an asset address the game can load, such as an image or sound.

function getcustomasset(path: string): string

isfile

Also available as is_file

Returns true if the path is a file.

function isfile(path: string): boolean

isfolder

Also available as is_folder

Returns true if the path is a folder.

function isfolder(path: string): boolean

listfiles

Also available as list_files

Returns the paths of the files and folders directly inside a folder.

function listfiles(path: string): { string }

loadfile

Also available as load_file

Reads a Lua file from the workspace and compiles it into a function without running it. Returns nil and the error on a syntax error.

function loadfile<A...>(path: string): ((A...) -> any | nil, string?)

makefolder

Also available as make_folder

Creates a folder in the workspace.

function makefolder(path: string): ()

openfiledialog

Also available as openfilesdialog openfolderdialog savefiledialog item:Append item:Delete item:GetName item:IsFile item:IsFolder item:List item:MakeFolder item:Read item:Write

Lets you choose files or folders through a system dialog. The returned item has methods to read, write, append, list and delete only what you chose.

readfile

Also available as read_file

Reads a file from the workspace folder and returns its contents as a string.

function readfile(path: string): string

writefile

Also available as write_file

Writes a string to a file in the workspace folder, creating or replacing it.

function writefile(path: string, data: string): ()