lua-users home
lua-l archive

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


> We have debug hooks, which almost do the right thing with the "break on N
> instructions" feature, but they need to be set in advance, and choosing the
> N is not straightforward because it implies a performance vs responsiveness
> trade-off. It would be nice to have something like lua_break() that can be
> called on a Lua environment (which may be running some Lua code in another
> native thread), which would essentially call a user-supplied function
> before the next VM instruction gets executed, or at some other convenient
> VM execution milestone not very distant in future, in the original native
> thread.

You can implement a sort of 'lua_break' with hooks and signals; that
is how the stand-alone lua interpreter handles Ctrl-C, for instance.
(See file 'lua.c' in the main distribuition for details.) However,
like hooks, that cannot break loops in C code (e.g., library functions).

-- Roberto