Remote Debugging with MobDebug
Set up MobDebug and connect ZeroBrane Studio to debug running scripts.
Remote Debugging with MobDebug is a free Lua Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Lua Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
What Is MobDebug?
MobDebug is a Lua remote debugger. It allows you to set breakpoints, step through code, and inspect variables in a running Lua program from an IDE like ZeroBrane Studio.
Installing MobDebug
Install via LuaRocks: luarocks install mobdebug. Or copy mobdebug.lua into your project.
Starting the Debug Server
Add require("mobdebug").start() at the entry point of your script. This connects to the debugger IDE waiting on localhost:8172.
-- myapp.lua
require("mobdebug").start() -- connect to IDE
-- ... rest of your code ...ZeroBrane Studio Setup
Open ZeroBrane Studio, set the project directory, and start the debugger server (Project → Start Debugger Server). Then run your script — it will pause on entry.
Breakpoints
Set breakpoints in the IDE by clicking the line number gutter. When the script hits that line, it pauses and you can inspect variables.
Stepping
Use Step Over (F10) to execute the next line without entering function calls. Step Into (F11) enters the called function. Step Out (Shift+F11) runs until the current function returns.
Inspecting Variables
ZeroBrane's watch panel shows local variables and their values at the current breakpoint. You can also evaluate Lua expressions interactively in the console.
Conditional Breakpoints
Use require("mobdebug").pause() in code to create a programmatic breakpoint that only triggers when explicitly called.
if someCondition then
require("mobdebug").pause() -- pause only on condition
endRemote Debugging over Network
To debug a script on a remote machine: require("mobdebug").start("192.168.1.100", 8172) — connect to the IDE running on that IP.
Coroutine Debugging
MobDebug can follow execution into coroutines. Set a breakpoint inside the coroutine body and the debugger will stop there when the coroutine is resumed.
Limitations
MobDebug adds overhead. Do not use in production. Does not work inside sandboxed environments that block require or socket access.
MobDebug Question
What does require("mobdebug").start() do?
Recap: Remote Debugging with MobDebug
MobDebug enables breakpoints, step-through debugging, and variable inspection from ZeroBrane Studio. Add require("mobdebug").start() at entry. Use .pause() for conditional breakpoints. Not for production use.
Frequently asked questions
Is the “Remote Debugging with MobDebug” lesson free?
Yes — the full text of “Remote Debugging with MobDebug” is free to read here on the web, and the Lua Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Lua Academy course, upgrade to CoddyKit PRO.
What will I learn in “Remote Debugging with MobDebug”?
Set up MobDebug and connect ZeroBrane Studio to debug running scripts. You practise Lua Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Lua Academy?
No prior experience is required. Lua Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Remote Debugging with MobDebug” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Lua Academy lesson?
Yes. Every Lua Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- The debug Library in Depth
- Remote Debugging with MobDebug
- Profiling with LuaProfiler
- Code Coverage and Test Instrumentation