lua-users home
lua-l archive

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


>>Sorry, I meant that there is no integration 
>>with generic for loop and the toclose variables

>But this integration does exist. 
>Why do you think it does not?

Because it isn’t documented well. 

It should be explained more clearly in the manual and should *definitely be listed* amongst the significant changes from 5.3.5 to 5.4.0. 

(The minor change in integer for loops is listed as a major change but the major change in generic for loops isn’t listed at all.)

>io.lines("file") now returns 4 values:
 >readline_func, nil, nil, file where the readline_func
>is a closure that returns the next line from the
>file, and "file" is the filehandle that was opened,
>which will be closed via its __close metamethod.

This is one of only two places in the whole Lua codebase, and is the only library function, where __close is used (in both cases the code just sets __close = __gc).

Yet the manual fails to mention it at all. 

Everyone who was around and concentrating on this list when __close was discussed probably knows all this stuff, but how is anyone else supposed to find out? 

I grepped through the code, but I shouldn’t have had to.