Skip to content

writefile

writefile writes data to a file at the specified path. If the file already exists, its contents will be overwritten.

This is one of the primary ways to persist string data within the executor's file sandbox.

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

Parameters

Parameter Description
path The file path to write to.
data The string data to write into the file.

Example

Basic file writing example
writefile("file.txt", "Hello world")
print(readfile("file.txt")) -- Output: Hello world