lua-users home
lua-l archive

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


> the token filter must be reset before every loadstring, loadfile or  
> dofile call.  I'm trying to figure out why - the coroutines never  
> return so they should always be resumable.

It's because the lex state is saved as an upvalue of the raw get token
function that is passed to the token filter. So, although the coroutine
hasn't returned, it is still using an old lex state. I'm sorry, the docs
and the code should be more explicit about this. One simple way to handle
this is to set FILTER to nil when <eof> is seen.
--lhf