Debugger module for Lua, how to integrate?

I found this simple debugger on GitHub today and cannot find a way to incorporate the module into a Codea project as require is not supported. Any guidance is appreciated. Thanks in advance.

Using Codea 3.3.3 (280) and iPadOS 14.6

@krdavis - try building a separate debugger project with the debugger code in a tab other than main. then run that project as a dependency.

Just out of curiosity how does your debugger output its results?

I’m not sure if a debugger is going to work with Codea. Codea isn’t meant to be stopped and if it is, the debugger is going to have to access any variables within the running (now stopped) program.

@dave1707 - just why I asked the question on output.

Input and output are via stdin and stdout

Output and input could just as easily be directed to a socket…

@krdavis - like to see how you progress with this.

@Bri_G - tried the separate project approach and set the dependency in the project to be debugged. No go as I need to create the main debugger function someway other than local dbg = require("debugger") which works great outside of Codea, and I then can call dbg() to trigger the debugger. What other ways can one “require” a module in Codea? Does Codea still retain the debug library for access to debugging hooks needed to create a debugger?

@krdavis - need to address that to @Simeon. Could you tell us in a little more detail what you are actually doing to set this up.

See the code at the link at the beginning of this thread. It is a simple debugger you can drop into a Lua project. The debugger is a single module file that you integrate via a single require statement. A breakpoint is set by placing a call to dbg() just before the lines you wish to debug. All code and docs are at the link mentioned above.

@Simeon - do you think this could work? Additional info in the comments…

I got the module to load and then fail with with a call to dbg() an error on a call to os.exit(). Is this function supported?

Used a separate project for the debugger code and in the project to be debugged I added the debugger project as a dependency. I then added the following to the Main file of the debugged project:

package.path = os.getenv("HOME") .. "/Documents/" .. "Debugger" .. ".codea/?.lua"
local dbg = require("Debugger")

Any knowledge here would help, debugger code at link at top of this post.

I’ll try to get this running and see how we go!