[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: coroutine.yield from debug hook in LuaJIT 2
- From: Mike Pall <mikelu-1106@...>
- Date: Sat, 11 Jun 2011 16:20:18 +0200
> 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.