lua-users home
lua-l archive

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

Title: RE: About lua_newthread

> It strikes me the crux of this problem isn't that there's not a function
> to delete a thread, but simply that you're using the stack as a
> persistent store for thread objects. Take them off the stack, stash them
> some where more sensible - a member of the table representing the actor
> the thread represents, or a schedule table, or other similar options.

That's kind of true.  I'm not explicitly using the stack for storage, but seeing as I'm not doing anything with it either, I guess I am.  It was a very naive approach that I've had lots of guidance with now :)

> > On a similar note, is there a way of removing a non integer index from
> > a table?  I use the thread as a key in a table to match it up to a
> > game object, and when that object is destroyed I want to remove the
> > entry in the table as well.

> As others have said - weak tables.

Yup. :)