lua-users home
lua-l archive

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


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 thread: G(L)->mainthread
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?