lua-users home
lua-l archive

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


Any why not reuse a keyword?
 
do
...
then
...
end
 
local contents
local f = io.open("myfile")
do
    contents = f:read()
finally
    f:close()
end
 
This obviates the need for __close handling, and makes all the discussion about panic handlers and __gc moot since we would have control over the order of "closing"  and the handling of errors with nested do... finally... end and pcall.