All the examples given involves invoking a function in in pcall. Wouldn't be nice if LUA by his own create a function and invokate that function with pcall automatically when we do something like this:
try
-- protected code. A function/closure would be automatically created with this code. Will be called with "pcall"
catch (e)
-- catch code. Another function/closure would be automatically created with this code.
finally
-- finally code. One more function/closure woluld be automatically create with this code.
end;
We would have clean code for exception handling using the already given suggestions managed by LUA.
I am "in love" for LUA and I miss "native" exception handling statements. I think this way would be a relatively easy way to give to the language this ability natively.