lua-users home
lua-l archive

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

I was reading through the mailing list and I saw that you can forcibly stop a thread by removing all trace of it from the stack. I'm pretty new to lua, so I'm wondering if anyone can point me in the right direction. I am looking for the correct C API commands to use to pop from the stack. I'm afraid of introducing a memory leak.

Maybe its really easy and I just need to call :

threadState = lua_newthread(L);
<do stuff>
lua_pop(threadState, lua_gettop(threadState));

I am using the technique found in this posting to run AI scripts for a game, so I have lots of threads, and they need to be terminated immediately when the object they are attached to dies.