VSCodeLuaDebug icon indicating copy to clipboard operation
VSCodeLuaDebug copied to clipboard

How debug cocos2dx lua using lua debugger?

Open SambeauWang opened this issue 7 years ago • 1 comments

This plugin is very pretty, Thank for author. I use it to learn lua and cocos2dx. But when i debug cocos2dx code, i fail. There are my steps. (1) download vscode-debuggee.lua and dkjson.lua , put into my src folder. (2) add follow code in main.lua:

cc.FileUtils:getInstance():setPopupNotify(false)
require "config"
require "cocos.init"

local json = require 'dkjson'
local debuggee = require 'vscode-debuggee'
local startResult, breakerType = debuggee.start(json)
print('debuggee start ->', startResult, breakerType)


local function main()
    require("app.MyApp"):create():run()
end

local status, msg = xpcall(main, __G__TRACKBACK__)
if not status then
    print(msg)
end

(3) launch.json:

{
            "name": "launch-lua",
            "type": "lua",
            "request": "launch",
            "workingDirectory": "${workspaceRoot}",
            "sourceBasePath": "${workspaceRoot}/src",
            "executable": "${workspaceRoot}/simulator/win32/MyGame.exe",
            "listenPublicly": false,
            "listenPort": 56789,
            "encoding": "UTF-8",
            "env": {}
},

When run it, the result is follow. I fail to debug. image

SambeauWang avatar Sep 30 '18 07:09 SambeauWang

hellow, bro have you handle this problem?

Ander456 avatar Apr 28 '19 06:04 Ander456