lua-users home
lua-l archive

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


> -----Original Message-----
> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On
> Behalf Of Oliver Kroth
> Sent: woensdag 16 juli 2014 12:34
> To: lua-l@lists.lua.org
> Subject: Re: How can I do sethook() to all coroutines of a Lua state?
> 
> Thank you Thijs,
> 
> it's unfortunately not only for debug purposes.
> 
> But I could bypass the problem by finding the main thread of the Lua
> state and hooking the stop function there.
> As it is the central 'player' in COPAS (every other thread yield()s back
> to it and it resume()s to the next thread), it will stumble upon the
> hook anyway.
> --
> Oliver
> 
> Am 16.07.2014 11:40, schrieb Thijs Schreijer:
> > For debug purposes, monkey patch the coroutine table functions, to
> > store all generated coroutines in a weak table in the registry. Thijs
> 

It will work for all operations, not just debug. But monkey patching is considered harmful around here. But if it works for you, nobody is stopping you from doing so. What do you want to accomplish with the debughooks?