|author||Roberto Ierusalimschy <email@example.com>||Wed Oct 31 14:54:45 2018 -0300|
|committer||Roberto Ierusalimschy <firstname.lastname@example.org>||Wed Oct 31 14:54:45 2018 -0300|
State in generic 'for' acts as a to-be-closed variable The implicit variable 'state' in a generic 'for' is marked as a to-be-closed variable, so that the state will be closed as soon as the loop ends, no matter how. Taking advantage of this new facility, the call 'io.lines(filename)' now returns the open file as a second result. Therefore, an iteraction like 'for l in io.lines(name)...' will close the file even when the loop ends with a break or an error.