Playrix Script Debugging Extension for Visual Studio Code
Adds Playrix script debugging support to Visual Studio Code.
Currently supports:
- setting source breakpoints;
- setting function breakpoints;
- conditional breakpoints;
- logpoints;
- watches;
- executions Lua code from debugger's console (REPL);
- stepping into/through code: step, step-in, step-out;
- allow to break/pause script execution;
- seeing values for local and global variables (GLOBALSINDEX):
- primitive types: numbers, booleans, strings;
- compound types: tables/arrays, closures;
- navigating the call stack: distinguishes lua/с++ frames;
Overview
Playrix lua script debugger.
Quick start
- Install this extension from VSCode Marketplace
(or by entering
ext install homescapes-tech.lua-debugger
at the command palette win: Ctrl+P).
- Open project's folder
- Create attach configurations by going into Debug section (win: Ctrl + Shift + D) and either select "Add Configuratio"n from the drop-down or press Configure or Fix “launch.json” button.
- Click on Start Debugging in the Debug tab in VS Code;
Using debugger expressions (break point condition, watches, REPL commands).
Any lua code can be used as expression for bp's conditions, watches or REPL commands.
To using function local variables (or closure upvalues) such variable should be prefixed by dollar sign '$'.
For example:
function MyFunction()
local myObject = {}
myObject.name = 'some value'
-- ...
end
to see value of 'myObject.name' expression should be written as:
$myObject.name
in other case expression will refer to global 'myObject' variable (that is nil or or has an unexpected meaning).
Expression for conditional breakpoint must always be evaluated to boolean
(if there is an error while evaluating condition expression or it does not evaluated to boolean execution will be break unconditionally)
Configuration
Extension by default creates the following configuration:
{
"type": "playrix-lua",
"request": "attach",
"name": "Lua: attach project",
"projectRoot": "${workspaceRoot}/base_mm",
"host": {
"address": "tcp://:62847"
}
}
}
Also multiply hosts can be specified. In this case each time debug is started target host must be selected prior session will be runned.
{
"type": "playrix-lua",
"request": "attach",
"name": "Lua: attach project",
"projectRoot": "${workspaceRoot}/base_mm",
"host": {
"addresses": {
"Localhost": "tcp://:62847",
"Android (SANSUNG)": "tcp://192.168.1.45:62847",
"Android (Xiaomi)": "tcp://192.168.1.44:62847"
}
}
}
}
- type: “playrix-lua” – type of debugger to be used.
- request: attach
- projectRoot:: assets root (from where scripts are loads);
- host:
- address:: debug host address (tcp://localhost:62847);
- addresses:: list of the available hosts;