Error Handling
Because nzLua is embedded inside of the database, all nzLua actions start with the database calling a function in the nzLua code. Whenever an error occurs, control returns to the database and the SQL statement will be aborted with the appropriate error message.
Lua code can explicitly generate an error by calling the error function. If you need to trap errors in Lua, you can use the pcall or xpcall functions.
ok,result1,result2 = pcall(myfunction, arg1, arg2, ...);
if not ok then error("myfunction failed!") end