中文 | English
Debugging Guide
Wingman's Lua debugging is based on EmmyLua. The repository ships a VS Code configuration that can be used directly for attach debugging and for running the current script through the runtime.
VS Code Configuration
Install the extensions suggested by VS Code first, or install them manually:
tangzx.emmyluasumneko.luams-python.pythonms-python.vscode-pylance
Files bundled in the repository:
| File | Purpose |
|---|---|
.vscode/launch.json | The Attach to Wingman Lua (EmmyLua :9966) configuration plus script run configurations |
.vscode/settings.json | Lua, the Wingman Lua type library, and Python stub paths |
assets/vscode-wingman-lua/ | Lua API completion declarations (wingman.d.lua aggregate + defs/ per module) |
libs/python/typing/wingman | Python API type declarations |
See VS Code Development Environment for the full configuration details.
Lua Debugging Workflow
- Build the runtime:
powershell -ExecutionPolicy Bypass -File build-scripts\ci\configure-windows.ps1+cmake --build build --config Release - Confirm debugging is enabled in the runtime configuration:
[debugger] enable = trueinapps/agent/config/agent.toml - In VS Code, select
Attach to Wingman Lua (EmmyLua :9966) - Run the Lua script you want to debug
- Use breakpoints, stepping, and the variables panel to locate the problem
The default debugging port is 9966.
Running the Current Script
The VS Code Run current Lua script (runtime) and Run current Python script (runtime) commands execute:
powershell
.\build\apps\agent\Release\wingman-agent.exe script <当前文件>Python scripts require reconfiguring the build with WINGMAN_ENABLE_PYTHON=ON.
Logging-Based Debugging
Use the notification/logging modules to output debug information:
lua
local wingman = require("wingman")
wingman.notify.info("Info message")
wingman.notify.warn("Warning message")
wingman.notify.error("Error message")Troubleshooting
Script Not Responding
- Check for infinite loops
- Narrow the screenshot or image-matching region
- Add log output at key branches
Performance Issues
- Optimize the image search region
- Reduce unnecessary screenshots
Breakpoints Not Hit
- Confirm port 9966 is not already occupied
- Confirm
.vscode/launch.jsonhas theemmylua_newconfiguration selected (Attach to Wingman Lua (EmmyLua :9966)) - Confirm VS Code is connected to
localhost:9966