lua-users home
lua-l archive

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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

only an idea: What about something like this:


~      function try(body_function, exception_handler)
~        ...
~      end

~      function foobar(...)
~        local socket = nil
~        try { function()
~          -- some code that raises an error
~          socket = socket_open(...)
~          socket_send(socket, ...)
~          socket_read(socket, ...)
~        end;
~        function()
~          -- called when an error was raised
~          if socket then
~            socket_close(socket)
~          end
~        end }
~      end


-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBFBxzSIrOxc3jOmoRApQnAKCywYikA8XjHfzS1mwJKbDc3och1ACgkqyG
vF1DaWl2iEkHaS66y65NjSQ=
=Ht8F
-----END PGP SIGNATURE-----