[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: How can I do sethook() to all coroutines of a Lua state?
- From: Oliver Kroth <oliver.kroth@...>
- Date: Wed, 16 Jul 2014 14:50:19 +0200
nothing very special, I just wanted to terminate a running script from
another OS process.
lua.c uses for this the function Lua_sethook() and inserts a C function
that throws an "stopped" error..
Works like a charm, but if you attach your stopper into the hook of a
thread (coroutine) that is not the main thread, only this thread is
stopped; the others, including the main thread, survive.
Luckily, finding the main thread is relatively easy:
go from LuaState *L to the global state and from there to its main
Then, shoot the boss :-)
16.07.2014 14:33, Thijs Schreijer wrote:
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?