Module macro.try

A try/except block.

This generates syntactical sugar around pcall, and correctly distinguishes between the try block finishing naturally and explicitly using 'return' with no value. This is handled by converting any no value return to return nil.

Apart from the usual creation of a closure, this uses a table to capture all the results. Not likely to win speed contests, but intended to be correct.

Macros

try A try macro, paired with except.


Macros

try
A try macro, paired with except.

try

  maybe_something_bad()
 except (e)
  print(e)
 end