Answer a question

I want to debug Lua code in Visual studio code. Tried to use the Extension "Lua Debug" by actboy168, but at start, I get following Error message:

C:\Users\morit\Documents\Projects\luamake>tools\ninja.exe -f ninja\msvc.ninja [0/5] cmd.exe /C cd tools\msvc && lua.exe init.lua ....\3rd\bee.lua\build\msvc\msvc-init.ninja [1/5] cmd.exe /C cd 3rd/bee.lua && ....\tools\ninja.exe -f build\msvc\msvc-init.ninja ninja: error: build\msvc\msvc-init.ninja:3: loading 'ninja/msvc.ninja': Das System kann den angegebenen Pfad nicht finden. subninja ninja/msvc.ninja ^ near here FAILED: build/msvc/_/bee cmd.exe /C cd 3rd/bee.lua && ....\tools\ninja.exe -f build\msvc\msvc-init.ninja ninja: build stopped: subcommand failed.<

Anyone knows how I can get it to work?

Answers

if you want to debug a file e.g. test.lua, simply add a .vscode/launch.json containing:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "lua",
            "request": "launch",
            "name": "Launch",
            "program": "${workspaceFolder}/test.lua"
        }
    ]
}

then hit "Run"->"Start Debugging" and select the lauch target.

Please keep in mind to address the correct file in "program": before starting.

This will enable your debugging mission. Then you can simply execute it by F5 (or whatever your mapping is).

The extension to Visual Studio Code named "Lua Debug" and "extensionPath" by actboy168 (Thank you!) need to be installed beforehand.

It is also handy to have lua installed with the path set to it, but it is optional.

I also struggled in compiling the example "luamake" (https://github.com/actboy168/luamake) , but it is simply an example, which you can use to start debugging yourself. As soon as you load this in visual studio, you will notice, it will work to debug it as well. So the lauch.json is there as well.

Logo

开发云社区提供前沿行业资讯和优质的学习知识,同时提供优质稳定、价格优惠的云主机、数据库、网络、云储存等云服务产品

更多推荐