Debug adapter implementation for Lua / MobDebug
This application implements everything thats necessary for communicating with your editor using DAP via stdio and re-implements all the MobDebug server functionality, waiting for a client to hook into the server
Download a copy of mobdebug.lua and put it somewhere into your project.
When you want to debug import it and call the start function:
-- perhaps hidden behind an env variable or whatever
if enable_debugger then
local debugger = require "mobdebug"
debugger.start("127.0.0.1", 8172) -- NOTE: the port here, this has to be the same as in your editor config
end
local dap = require "dap"
dap.adapters.mobdap = {
id = "mobdap",
type = "executable",
command = "/path/to/mobdap",
}
dap.configurations.lua = {
{
name = "MobDebug",
type = "mobdap",
request = "launch",
-- these are the parameters you might want to configure
-- rootdir: The path to your project root
rootdir = function()
return vim.fs.root(0, { ".git" })
end,
-- sourcedirs: (Optional) Alternative search dirs for dependencies
sourcedirs = {
"/home/USERNAME/.luarocks/share/lua/5.1",
},
-- port: (Optional: Defaults to 8172) the port on which the server is running
-- Please configure the same on your client
port = 8172,
},
}
- Using mobdap with Defold: defold-mobdebug
- Debugger integrated with Neovim for Defold: defold.nvim
GPLv3