[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: problem lua_yield and lua_resume
- From: "mos" <mmosquito@...>
- Date: Mon, 1 May 2006 13:36:59 +0800
Hi
sorry . it is my fault after I read the 5.1 manal
lua_yield
int lua_yield (lua_State *L, int nresults);
Yields a coroutine.
This function should only be called as the return expression of a C
function, as follows:
return lua_yield (L, nresults);
so modify the code like
//void MyYield(const char*szWait)
//{
// cout << "thread is waiting for " << szWait << endl;
// swait = szWait;
// lua_yield(L2,0);
//}
//int luaMyYield(lua_State* LL)
//{
// MyYield(lua_tostring(LL,1));
// return 0;
//}
int MyYield(const char*szWait)
{
cout << "thread is waiting for " << szWait << endl;
swait = szWait;
return lua_yield(L2,0);
}
int luaMyYield(lua_State* LL)
{
return MyYield(lua_tostring(LL,1));
}
but after do it , the lua works ok but luabind crashed !
my God !