lua-users home
lua-l archive

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


On 9/29/2011 6:50 PM, HyperHacker wrote:
> The message is correct; in Lua 5.1 a coroutine can't yield across a
> C function call. 5.2 allows this.


Sorry, but LuaCoco changes this behavior. [1] Note that ANY function under LuaJIT 1.x can become a "C function", and so yield() wouldn't work from within a compiled Lua function if what you're saying is true. Yet it does.

LuaCoco should let you yield across a C boundary, since it creates a C stack for each coroutine.

What do you see when you run:
  print(coroutine.coco)
?

If it's true, then it should work, as far as I know. That's how lua_yield() is changed by LuaCoco. If it's nil, then you're not using LuaCoco, which would explain the issue.

Tim

[1] http://coco.luajit.org/api.html