I've found different ways .. if its a simple Lua situation, where you just want to debug pure Lua code, Zerobraine Studio is a pretty good environment to do it and comes with a debugger.
I've tried various other Lua debuggers over the years, these are useful:
Otherwise, I just use gdb if needed (JIT/FFI stuff) and printf's.
However, I don't really need to debug much these days - more just testing. Its also kind of important to have automated tests and run them frequently with every major change.
Another thing I use frequently in my Lua projects, which I think cuts down a lot of the common bugs that might require debugging, is the lua_enumerable.lua utility module:
I've tried various other Lua debuggers over the years, these are useful:
https://github.com/slembcke/debugger.lua
https://slembcke.github.io/DebuggerLua
You can also use the debug module:
https://www.tutorialspoint.com/lua/lua_debugging.htm
Otherwise, I just use gdb if needed (JIT/FFI stuff) and printf's.
However, I don't really need to debug much these days - more just testing. Its also kind of important to have automated tests and run them frequently with every major change.
Another thing I use frequently in my Lua projects, which I think cuts down a lot of the common bugs that might require debugging, is the lua_enumerable.lua utility module:
https://github.com/mikelovesrobots/lua-enumerable/