File system access rooted at C:\wingless\scripts\data. Requires insecure mode.
File system access rooted at C:\wingless\scripts\data. Requires insecure mode.
Functions
Function
Returns
Description
file.read(name)
string?, error?
Read file contents
file.write(name, text)
bool
Write to file (creates or overwrites)
file.append(name, text)
bool
Append to file
file.exists(name)
bool
Check if file exists
file.remove(name)
bool
Delete a file
file.list([folder])
table
List directory contents
All paths are relative to the data root. Directory traversal outside the root is blocked.
Example
file.write('log.txt', utils.date() .. ' script loaded\n')local data = file.read('settings.json')if data then local cfg = json.decode(data) print(cfg.name)end