lua-users home
lua-l archive

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

Roberto Ierusalimschy" wrote on 09-04-2012 15:40 
> You are right. Lua does not support yielding from any hook. At least
> the documentation should say that.
> -- Roberto

This then would include count and line hooks? I can understand this from the philosophy that Lua doesn't support preemption, and yielding from hooks are nothing else but preemptive yields.
What confuses me a bit is that there is support for yielding from line and count hooks in the function traceexec in lvm.c (from the lua source code):

  if (L->status == LUA_YIELD) {  /* did hook yield? */
    ci->u.l.savedpc--;  /* undo increment (resume will increment it again) */
    luaD_throw(L, LUA_YIELD);

I use this feature and works perfectly in our project. Anyway thanks a lot for the improvements in yielding in 5.2. I had to do a lot of modifications to the 5.1 interpreter to fit our needs that were not needed anymore in Lua 5.2 :-)