lua-users home
lua-l archive

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


Greg wrote:
> Is it possible to yield form a coroutine in a debug hook in LuaJIT 2? 
> Currently, I get the error "attempt to yield across C-call boundary." 

You can yield from a C hook (lua_sethook), but not from a Lua
hook (debug.sethook) which sits on top of a C frame. That's the
same behavior as plain Lua.

> However, I think I was able to do this with LuaJIT 1.x.  

Yes, but LuaJIT 1.x used a different mechanism which involved
creating and switching between multiple C stacks. LuaJIT 2.x uses
a resumable VM, which has many advantages. Alas, a few uncommonly
used yield points no longer work.

--Mike