Skip to content

How debug cocos2dx lua using lua debugger? #15

@SambeauWang

Description

@SambeauWang

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions