Debugging scripts
The editor has a debugger for both Luau and AngelScript. It works while the game plays in the Game tab.
Stopping at a line
Section titled “Stopping at a line”- Open the script in its page and click in the margin beside a line to set a breakpoint. Click again to clear it.
- Play the game with Game > Play.
- When the script reaches the line, the game pauses and the debugger panel opens beside the game in the Game tab. If the script’s page is open, it marks the line where the script stopped.
Breakpoints set or cleared while the game plays apply at once. The editor keeps them until it closes.
Looking around
Section titled “Looking around”The debugger panel opens by itself at a break; the bug button on the Game tab’s toolbar shows or hides it at any time. It shows:
- whether the scripts are Paused or Running;
- the Call stack, the functions that led to this line, each with its file and line;
- the Locals, the variables in the innermost function, each with its value and type. An object or table lists its members one level under it.
While the script is paused, hold the mouse over a name in the script’s page to see its value.
Moving on
Section titled “Moving on”| Button | What it does |
|---|---|
| Continue | Run until the next breakpoint |
| Step Into | Run to the next line, going into a function the current line calls |
| Step Over | Run to the next line, running any function the current line calls in full |
| Break | Stop the scripts at the next line they run |
There is no step out, and breakpoints have no conditions. To stop on one case, put the line
inside an if and set the breakpoint there.
The debugger works only in the Game tab: a scene page’s Simulate does not stop at
breakpoints, and neither does an exported game. In an exported game, lines written with
Log.info and the other Log functions show what a script did.