|
于 2013-12-19 9:46, Isaf 写道:
I'm sorry, but I cannot find the `io_readline' function in my Lua installation and the documentation. After reading your message, I suppose you mean the iterator function returned by io.lines(some_file) by `io_readline', do you? And yes, I checked and found that the iterator really returned *no value* rather than *nil* at EOF. Although it has the same effect as long you use the iterator only in the context of *for* loop, I still think we need a change either to the manual or to the implementation to make them consistent. I personally prefer to change the implementation, as this comforms to the description of the *generic for statement* and *iterator* in the manual: > [quoted from the reference manual] > The generic for statement works over functions, called iterators. On each iteration, the iterator function is called > to produce a new value, stopping when this new value is nil. > [...] |