lua-users home
lua-l archive

Re: Can LuaCoco yield from outside of a Lua C Function?

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


mitchell wrote:
> 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.
--Mike

AltStyle によって変換されたページ (->オリジナル) /