Skip to content

File

Reference for the file API.

WARNING

Paths are limited to the Lexis folder, trying to use a path in another directory will fail.

Functions

file.exists

If a file exists.

lua
---@param path string
function file.exists(path): bool

file.remove

Deletes a file.

lua
---@param path string
function file.remove(path): bool

file.open

Deletes a file.

lua
---@param path string
---@param options { append: bool, create_if_not_exists: bool }
function file.open(path, options): file

Types

file

FieldType
validbool
textstring
jsonjson

Examples

lua
local handle = file.open(paths.cheat .. 'test.txt', { create_if_not_exists: true })
if handle.valid then
  handle.text = 'this is test text'
end