lua-users home
lua-l archive

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


> When experimenting with this, I actually noticed a bug:
> 
> The manual says:
> 
> >When the iterator function detects the end of file, it returns no
> >values (to finish the loop) and automatically closes the file.
> but actually
> 
> for l in io.lines( "foo.txt", "*a" ) do  print( l )  end
> 
> [...]
> 
> will loop forever (tested in 5.3 and 5.4(git)).

We should fix the manual, not the implementation. The manual is clear
that the iterator function works like file:read, and file:read never
fails (returns nil) with the "*a" format.

Thanks for the report.

-- Roberto