lua-users home
lua-l archive

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


Hi everyone,
 
I read several articles about lua 5.2, but confused about environment tables. some says lua functions don't have environment tables any more, but in the document of lua 5.2-work1/2, it says there is no global tables but environment tables. so, what kind of environment table is there? I also found a new introducing function, loadin. my concern is where are the entries provding to loadin? in the envrionment table or the global table? what's the scope of those entries? can these variables be a closure?
 
Also, i have some questions about the coroutines. because i will create and dispose lots of coroutines, i have to implement a coroutines pool to optimize this payload. it works fine when a coroutine ends normally, not yielded, no errors. so I can recycle it into my pool. but when the coroutine yields or errors, lua seemed saves the status and the stack of the coroutine, and I didn't find a way to reset the coroutine to the initial state, where I can put a new function to run. in this case, i have to dispose the coroutine rather reuse in my pool. it still works fine now since so far i don't need to terminate a yielding thread, but I guess this would happen in some time... so I was wondering if there is a way to reset a coroutine to the initial state, in 5.1 or any new functions will be introduced to 5.2?
 
many thanks!
 
Hao