Hi,
David Morris-Oliveros wrote:
It would be similar to the hooks in lua, but rather lua calling the
hook
every 5 instructions, i let it execute those 5 instructions, then it
comes back to me.
That's inversion of control. Lua already supports that with the
help of coroutines. And lucky you, you can yield from a count hook
(or line hook).
So from C do a lua_newthread() and then lua_sethook() to install
your count hook. When the hook decides that the timeout is reached
it forces a yield for the coroutine with 'return lua_yield(L, 0)'.