[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: coroutine.resume() vs. lua_resume
- From: Rici Lake <lua@...>
- Date: Thu, 10 Feb 2005 19:28:17 -0500
On 10-Feb-05, at 6:41 PM, Scott Graham wrote:
Can someone explain how coroutine.resume differs from lua_resume? Is
there a
way to do what I'm trying to do, or must I always use the first
version?
lua_resume's first argument is *the thread itself*. So you need
something like this:
{
lua_State *L1;
lua_getglobal(L, "my_coroutine");
L1 = lua_tothread(L, -1); /* get the thread */
/* make sure L1 is not NULL */
status = lua_resume(L1, 0); /* resume the thread */
/* make sure status is 0 */
lua_pop(L, 1);
}
if you need to pass arguments or receive results, see lua_xmove()