Home >Development Tools >VSCode >What to do if vscode lua breakpoint fails
What should I do if the lua breakpoint fails in vscode?
Using VSCode breakpoints to debug Lua tutorial
1. Install Visual Studio Code (vscode) and search and install luaide in the Plug-in Center
2. Configure luach.json
1. Drag the project folder directly into vscode
2. Debug icon in the left column->Settings-> ;Select LuaDebug, and the launch.json file will appear
3. Find the exePath field in the launch.json file and modify it to the simulator path
For example : "exePath": "D:/xxx/player-3.x/player3.exe",
Just configure the default in other places.
三.lua breakpoint debugging configuration
1. Download the file LuaDebug.lua
Address: https://github.com/k0204/LuaIde
2. Place the LuaDebug.lua file in the project src directory
3. Add debugging code
Add the following code in the main.lua file:
local breakInfoFun,xpcallFun = require("LuaDebug")("localhost", 7003) --3.x --1.断点定时器添加 cc.Director:getInstance():getScheduler():scheduleScriptFunc(breakInfoFun, 0.3, false) --2.程序异常监听 function G__TRACKBACK(errorMessage) debugXpCall(); print("----------------------------------------") local msg = debug.traceback(errorMessage, 3) print(msg) print("----------------------------------------") end local status, msg = xpcall(main, G__TRACKBACK) --如果是2.x CCDirector:sharedDirector():getScheduler():scheduleScriptFunc(breakInfoFun, 0.3, false) function G__TRACKBACK(errorMessage) debugXpCall(); print("----------------------------------------") local msg = debug.traceback(errorMessage, 3) print(msg) print("----------------------------------------") end local status, msg = xpcall(main, G__TRACKBACK)
The above is the detailed content of What to do if vscode lua breakpoint fails. For more information, please follow other related articles on the PHP Chinese website!