Hi Ignacio, > However, when I run this script under the debugger, the assert at line 5 fails. If I don't use the debugger, everything works fine. You are right; this situation needs a bit more detailed explanation. Mobdebug provides two ways to initiate debugging: start() and loop() calls. Including require("mobdebug").start() in your script does a simple thing: it installs debug.hook on the "main" coroutine, does a little bit of setup work, and returns. Your script continues to execute, but now under the debugger. Using require("mobdebug").loop() works a bit differently. Notice that in the first case you need to modify your code to include the start() call. But what if you don't want to do that? Or if you want to be able to provide (and change) the code at run-time? When you call loop(), it will start debugging with a dummy script and will be ready for the client (the IDE in our case) to send some code for it to execute. When it gets the code, it starts debugging in a similar way to start(), but in a separate coroutine (and this is why your second assert on line 5 fails). It seems like your callback is always executed in the "main" coroutine, and this is why it wasn't working initially (and not working with .coro() call as it only affects execution inside coroutines). This also allows the debugger to abort that coroutine and create it with some new code (which supports live coding). To make long story short; you have two options: (1) use it as is and take the fact that it's running in a coroutine when debugged as a feature. (2) remove loop() from your interpreter and add start() call to the main script. In that case you won't need coro()/on() calls as everything will be executed in the "main" coroutine. You can still choose between debug/run in this case as you can probably provide an additional parameter that would allow you to choose between the two. For example, look at love2d.lua interpreter and its -debug parameter. Hope this clarifies things a bit... Paul. On Wed, Apr 10, 2013 at 8:42 AM, Ignacio Burgueño <iburgueno@xxxxxxxxx>wrote: > Hi Paul. > > mobdegub.coro() does not work. However, calling mobdebug.on() inside that > callback did work. The strange issue is that I'm not using coroutines. > Everything is running off the main thread. > > However, when I run this script under the debugger, the assert at line 5 > fails. If I don't use the debugger, everything works fine. > 1: setInterval(function() > 2: assert(coroutine.running() == nil) > 3: console.log("%s", os.time()) > 4: end, 2000) > 5: assert(coroutine.running() == nil) > 6: process:loop() > > >