lua-users home
lua-l archive

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

> And this will never cause the "attempt to yield across metamethod/C-call
> boundary" error (that can happen in lua_yield() if L->nCcalls > 0? 
> It seems like there are some conditions that this might not work under
> (but perhaps I misunderstand the source).  In particular, if the hook
> happens while a metamethod is running or inside of lua code called
> from c code from lua code, will it happily yield or will there be an
> error.

You can never yield across a C boundary. So, if the hook happens inside
a metamethod (or any other form of C call) and you call lua_yield
anyway, then you will have an error. But it is not difficult to check,
inside your hook, whether there are C calls in the stack, and therefore
whether it is safe to yield.

-- Roberto