[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Can LuaCoco yield from outside of a Lua C Function?
- From: Mike Pall <mikelu-1110@...>
- Date: Sun, 2 Oct 2011 18:20:14 +0200
> Thanks for the response. My question is how to I get the coroutine's
> Lua state? What I gather from your response is that when run_ruby()
> is called, the lua_State passed to it is the main thread.
No, run_ruby() _does_ get the coroutine state.
But your code excerpt doesn't show where l_yield() gets 'L' from.
And since you get that error it must be the wrong state.
> Do I have to create the thread using coco's lua_newcthread() and use
> it's returned Lua State?
Well, yes, if you really want to do it from C. But doing it from
Lua (as shown) works just as well.