lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> Can I use debug.getinfo to have info on the call stack of the main thread if 
> I'm in a another coroutine ?
> It seems that the main thread isn't a couroutine ( coroutine.running returns 
> nil in the main frame ) so I don't know how to set the first param of 
> getinfo to indicate the main thread...
> Is it possible ? If yes, how ?

This is not possible now :( We probably will change it in 5.2. For now,
you can make the following "fix" in lbaselib.c:

 static int luaB_corunning (lua_State *L) {
-  if (lua_pushthread(L))
-    lua_pushnil(L);  /* main thread is not a coroutine */
+  lua_pushthread(L);
   return 1;

(Then coroutine.running will return the main thread.)

-- Roberto