lua-users home
lua-l archive

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


Hi,

D Burgess wrote:
> With one hook, could the hook could determine which thread caused
> the hook to be invoked?

A hook is always called within the thread that caused the invocation.

So this is no problem for C code, since lua_State is passed to every
call (and this just happens to be the thread handle). But I think there
is no way to push this handle to the stack, so you cannot operate on
it with lua functions (e.g. to store it in a table). I guess we need to add
lua_pushthread()?

I see no way to get at the current thread from within Lua code. I've
proposed coroutine.current() and an extension to debug.getinfo() to
allow for that. See my previous message on this list.

Bye,
     Mike