Added test for outputing each task by file in apitest.lua.
Added panic handler used to catch lua errors.