lua-users home
lua-l archive

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



Michael T. Richter wrote:
Threads in Lua are subject to garbage collection too. If you pop the
new thread without storing it somewhere else, it will be eventually
collected (and the whole edifice will crumb down ;).


OK, so that makes sense.  An unholy amount of sense, in fact, and I'm
ashamed I didn't spot that.

This leaves me with one question outstanding, however: If I do choose to pop
it and store it somewhere else, what can I actually do with it later on?
There doesn't seem to be any API dedicated to taking such a thread and doing
something useful with it -- or am I just missing something blindingly
obvious at this stage of the game?

I presume that you can resume it from a script with coroutine.resume. See luaB_coresume in lua-5.0/src/lib/lbaselib.c

- Peter Shook