Executes a function in protected mode with a custom error handler

See also Lua library functions.


status, ... = xpcall(f, err)


  • f - A function (function)
  • err - Error handler function to be used should f cause an error (function)


  • status - True if the function succeeded without errors; false otherwise (boolean)
  • ... - If status is false, the error message produced by the function; if status is true, the return values from the function (list or string)
This function is defined in the Lua standard libraries