lua-users home
lua-l archive

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


Hi,

David Given wrote:
> * Coroutine calls coroutine.yield.
> * 'Attempt to yield across yada yada'.

Try print(debug.traceback()) immediately before the yield and
ye shall see.

> void luaD_call (lua_State *L, StkId func, int nResults) {
> 
> This functions appears, from what I can tell, to be the bottleneck through 
> which all invocations of Lua pass. It is not possible to execute Lua, from 
> outside Lua, without passing though the above code.

No. luaV_execute() is called from two places.
You want the other one. It's called resume(). :-)

Ok path:

-> lua_resume
--> resume
---> luaV_execute
----> luaD_precall
-----> luaB_yield
------> lua_yield
<------

Your problem:

-> lua_resume
--> resume
---> luaV_execute
----> luaD_precall
-----> luaB_pcall or a C function which calls back into Lua <-- !!
------> lua_pcall or lua_call
-------> luaD_call       nCcalls++
--------> luaV_execute
---------> luaD_precall
----------> luaB_yield
-----------> lua_yield   nCcalls > 0 -> throw error

Bye,
     Mike