Workspace & files
The folder your scripts can read and write, and the rules that keep it safe.
Every file function in the Lynx API, from readfile and writefile to listfiles, works inside one folder: the workspace. Scripts can't reach anything outside it.
Where it lives
The workspace is the Workspace folder under Files in the editor's sidebar. Settings → Client → Open Workspace opens it in File Explorer.
Paths
- Paths are relative to the workspace root:
"configs/settings.json", never"C:\Users\...". - Use forward slashes. Backslashes work too, but forward slashes keep scripts portable.
- Paths that lead out of the workspace, such as absolute paths or
..segments, are rejected with an error. makefolderandwritefileboth create missing parent folders.
Blocked file types
Scripts can read any file in the workspace, but can't write files Windows would run or unpack:
writefile and appendfile raise an error for these extensions, and for a few rarer ones of the same kinds.
Saving script data
A common pattern: keep a script's settings as JSON in its own folder, with defaults when nothing is saved yet.
The Files sidebar
The sidebar's Files view lists Scripts, Workspace and AutoExec and follows the folders live. Click a script to open it in a tab. Right-click for Execute, Rename, Duplicate, View in Explorer and Delete. CtrlP finds an open tab or a recent script by name.
Written for Lynx 0.0.0
Something unclear? Tell us on Discord