lua-users home
lua-l archive

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


> I think I see how this would work.
> My additonal  problem is that I have environments that 
> lifetime does not match the thread lifetime.

I came at the unrequire solution empirically. While searching for the
problem I tried it and it solved the problem. It forces require to load
the file again in the new thread, rather than being fooled by the
package.loaded table entry.
 
> As a slightly offf topic question, the doco says that once a 
> coroutine returns then it is dead and cant be resumed again. 
> Do you know the rules for C created threads and C lua_resume? 
> Can I keep using the thread lua_State if the lua_resume 
> returns an error or completes?

Sorry, I don't know the answer to this. I don't use yield or resume at
all. Instead scripts register event handlers and update functions. These
functions are all coded so that they only perform a discrete amount of
processing (usually based on the delta time) before returning. Script
objects change states by changing the registered update function.

- DC