Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Debugger module for Lua, how to integrate?

in Questions Posts: 64

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

Comments

  • Posts: 2,277

    @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?

  • dave1707dave1707 Mod
    Posts: 9,298

    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.

  • Posts: 2,277

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

  • Posts: 64

    Input and output are via stdin and stdout

  • Posts: 64

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

  • Posts: 2,277
    @krdavis - like to see how you progress with this.
  • Posts: 64

    @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?

  • Posts: 2,277

    @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.

  • edited June 15 Posts: 64

    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…

  • Posts: 64

    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.

  • SimeonSimeon Admin Mod
    Posts: 5,648

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

Sign In or Register to comment.