[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: About lua_newthread
- From: "Raymond Jacobs" <raymondj@...>
- Date: Fri, 19 May 2006 10:12:34 -0400
I 'belive' that will work =)
On 5/19/06, mos <mmosquito@163.com> wrote:
>
> another method which I've not yet done but should work, is to
> create a new thread, create a lua reference to it (using
> lua_ref) then pop it off the stack immediately (so it doesn't
> get buried), and later when you are done with it, destroy the
> reference (lua_unref) and that should allow it to be GC'd
>
Hi!
I dont know how to do and I just try like this:
lua_State* m_L = lua_newthread(L);
int refKey = luaL_ref(L, LUA_REGISTRYINDEX);
NPC->L = L
NPC->m_L = m_L
NPC->refKey = refKey
and
NPC::~NPC(){
if (L)
{
luaL_unref(L,LUA_REGISTRYINDEX,refKey );
}
}
no error occur, but I wonder if it will work as I expect.
mos