Page 1 of 1

Debug with Lua, LOVE, VS Code

Posted: Tue Sep 08, 2020 4:08 pm
by Nekyia
Hello! :awesome:

I would like to know how you approach debbuging with LOVE ?
I am using VS Code with the plugin 'tomblind.local-lua-debugger-vscode'. I started briefly with ZeroBrane Studio and the debugger worked very well, but was much more happy with vs code.
I would like to uninstall zbs, but still use it occasionaly for the Local Console. My problem with vs code is that often the debugger doesn't seem to work. For example I would set a breakpoint and the debugging will ignore it. Or it refuses to display the variable names.
I end up using a lot of print() and feel like I am wasting a lot of time on debug.

Also how do you debug graphically? Do you add lines in the middle of the code? Write functions, that you may removed later?

In many game you can open a console and show stuff and control parameters with cvars. I am aware of the LoveDebug library, but my skills are limited and I would rather do some games before coding a console system tailor-made.

Sometimes I run the debuger and find the problem immediatly, but mostly it is just print()
I feel inefficient and it is very frustrating.

I am curious about how more experienced and smarter people do it?

Re: Debug with Lua, LOVE, VS Code

Posted: Mon Sep 28, 2020 10:22 am
by D0NM
Just putting this old topic of yours here
https://love2d.org/forums/viewtopic.php ... 0&p=234856

I remember running Love2D with VSC...
but the break point used to work once. I wasn't able to continue debugging. So I dropped the idea of debugging Love2D with VSC.

Re: Debug with Lua, LOVE, VS Code

Posted: Tue Sep 29, 2020 2:13 am
by sphyrth
I don't have a Rubber Duck with me, so I use that Inefficient Style you mentioned.

Re: Debug with Lua, LOVE, VS Code

Posted: Wed May 19, 2021 3:08 pm
by D0NM
Yo!
I just re-installed VSCode
I was looking at https://love2d.org/forums/viewtopic.php?t=88570

So, the new Lua debugger 'lldebugger' works like 3x faster than the 'mobdebug' in ZeroBrane Studio.

What do you need to make it working?
1. Add path to love.exe into your windows env
2. Install these VSC extentions: Local Lua Debugger by Tom Blind, LOVE by bschulte, Lua by sumneko.
3. add debugging config into launch.json (it is described in the Local Lua Debugger info page with LOVE2D example)
4. Select your config in "Run and Debug"
5. Press F5 :joker:

Here is my config

Code: Select all

        {
            "type": "lua-local",
            "request": "launch",
            "name": "Debug LOVE",
            "program":
            {
                "command": "love"
            },
            "args": 
            [
                "${workspaceFolder}",
                "vsc_debug"
            ],
        },
also I load the debugger in main.lua

Code: Select all

if arg[#arg] == "vsc_debug" then require("lldebugger").start() end