Skip to content

readfile

readfile retrieves the contents of a file at the specified path and returns it as a string.

If the file does not exist or cannot be accessed, the function will error.

function readfile(path: string): string

Parameters

Parameter Description
path The file path to read from.

Example

Reading a file
writefile("file0.txt", "Hello")
print(readfile("file0.txt")) -- Output: Hello