title: How to debug Lua Love2D with VSCode?
body: <p>I'm looking for suggestions on how to debug Lua Code in <a href="https://code.visualstudio.com/" rel="nofollow noreferrer">Visual Studio Code</a>. I'm using <a href="https://love2d.org" rel="nofollow noreferrer">Love2D</a>, so I understand that I will somehow need to embed my debugging code, because it is not standalone Lua, however I would prefer a minimal augumentation of my sources.</p>
  <p>Goal: Regular debugging with breakpoints, catch errors and variable inspection in VSCode.
  I don't mind which extension I use, as long as I can debug my code with ease.</p>
  <p>What I tried so far:</p>
  <ol>
  <li><p><a href="https://marketplace.visualstudio.com/items?itemName=devCAT.lua-debug" rel="nofollow noreferrer">Lua Debugger</a>: It worked somehow, it hit on a breakpoint, but only when calling <code>debuggee.poll()</code> and from there I couldn't step in or inspect further.</p>
  </li>
  <li><p><a href="https://marketplace.visualstudio.com/items?itemName=satoren.lrdb" rel="nofollow noreferrer">LRDB</a>: Seems promising, but somehow the game won't start. It just hangs until I kill it with the task manager.</p>
  </li>
  </ol>
  <p>Code for LRDB (generic update/draw functions not included, cause they are just for testing breakpoints):</p>
  <pre class="lang-lua prettyprint-override"><code>
  local lrdb = require &quot;lrdb_server&quot;
  local db_port = 21110
  
  function love.run()
      lrdb.activate(db_port)
  
      if love.load then love.load(love.arg.parseGameArguments(arg), arg) end
   
      -- We don't want the first frame's dt to include time taken by love.load.
      if love.timer then love.timer.step() end
   
      local dt = 0
      lrdb.deactivate()
      -- Main loop time.
      return function()
          lrdb.activate(db_port)
          -- Process events.
          if love.event then
              love.event.pump()
              for name, a,b,c,d,e,f in love.event.poll() do
                  if name == &quot;quit&quot; then
                      if not love.quit or not love.quit() then
                          return a or 0
                      end
                  end
                  love.handlers[name](a,b,c,d,e,f)
              end
          end
   
          -- Update dt, as we'll be passing it to update
          if love.timer then dt = love.timer.step() end
   
          -- Call update and draw
          if love.update then love.update(dt) end -- will pass 0 if love.timer is disabled
   
          if love.graphics and love.graphics.isActive() then
              love.graphics.origin()
              love.graphics.clear(love.graphics.getBackgroundColor())
   
              if love.draw then love.draw() end
   
              love.graphics.present()
          end
   
          if love.timer then love.timer.sleep(0.001) end
          lrdb.deactivate()
      end
  end
  </code></pre>
  <p>Any help would be appreciated.</p>