Executing scripts
Run code from the editor, files, projects and other scripts, and understand where it runs.
Executing is what Lynx is for. There are several ways to do it, and they all end up in the same place: a new thread in the Roblox clients you've chosen.
From the editor
Write or paste code into a tab and press CtrlEnter or F5, or click Execute. Lynx sends the whole tab to every client that is switched on under Clients.
The editor checks your code as you type with the Luau language server: problems are underlined, and completions and hovers know the Roblox and Lynx APIs. Errors a script raises while it runs show up as red lines in the Output panel.
From a file
Drag a .lua, .luau or .txt file onto the Lynx window to open it in a new tab, or click a file under Files in the sidebar. Open (CtrlO) browses for one. To run a file without opening it, right-click it under Files and choose Execute.
From a project
With a project open, Execute grows a menu. Run Project (CtrlF5) runs the project, Build (CtrlShiftB) bundles it into one script, Watch rebuilds on every change, and Execute Active File Only runs just the tab you're in.
From other scripts
Scripts can compile and run code themselves with loadstring, or load files from the workspace with loadfile.
Where your code runs
Every execution gets its own thread on Roblox's task scheduler, running on the client at thread identity 8. Your script can use the entire client-side Roblox API, including services, instances, task and RunService, plus the Lynx API.
- Environment. Your globals live in
getgenv, a table shared by every script you execute. Game scripts can't see it. - Yielding.
task.wait,WaitForChildand HTTP calls yield just like in a LocalScript. The editor stays responsive while they do. - Lifetime. Threads run until they finish, error, or you leave the game. Connections live as long as the instances they're connected to.
Stopping scripts
Lynx has no stop button. A script runs until it finishes, errors or you leave the game, and connections it made stay connected. Well-behaved scripts clean up after themselves, so they can be re-run safely:
The Output panel
With Settings → Client → Output Redirection on, everything your scripts print, warn or error appears in the Output panel under the editor. Click its header to fold it away. Filter it by text or by type, copy it or clear it with the buttons on the right. Identical lines collapse into one with a count.
Written for Lynx 0.0.0
Something unclear? Tell us on Discord