This project is based on the MoonSharp VSCode Debugger
This is an extension to allow debugging of Lua scripts running inside Pixel Vision 8.
- Connect to the currently running game's Lua script
- Supports breakpoints, watches, local variables,
self
inspection - Call stack, with visualization of current coroutine
- Watches can contain free formed expressions, as long they are side-effects free
- Inspection of values including internal ids and table contents
- Print statements are displayed in the debug console
- Editing of values not supported
- No checks are made for file contents changes
- Due to how vscode works, token-based breakpoints are not supported
-
Open Pixel Vision 8's Workspace Folder (located in your computer's User directory)
-
Create a new launch.json file in a
.VSCode
folder at the root of the Workspace directory with the following:
{
"version": "0.2.0",
"debugServer" : 41912,
"configurations": [
{
"name": "PV8 Debugger Attach",
"type": "pv8-debug",
"request": "attach",
"debugServer": 1985
}
]
}
-
Hold down the shift key while a game loads to begin the countdown for connecting the debugger.
-
In VS Code, select Debug -> PV8 Debugger then switch back over to Pixel Vision 8
-
Once the debugger is connected, you should see a debug icon in the title bar
-
When the game loads up, you should be able to trigger break points to inspect the code that is currently running. By default, the debugger will break on Init().
-
Type !scripts to display all of the script files that are currently loaded