lua-users home
lua-l archive

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


> The proposed 'defer' statement looks like this:
>
> defer ... end
>
> with the guarantee that f will be invoked at scope exit.
>
Can be done following way:

scope(function(auto) local defer=function(fn) auto(fn){true} end

    defer(function() print "defer1" end)
    defer(function() print "defer2" end)

end)

> 5) Variables may be captured as upvalues in the function too
Main problem of upvalues is: there is no effective way to isolate
function body from upvalues in lua.