Skip to content

Instantly share code, notes, and snippets.

@mrwonko
Created July 31, 2012 13:07
Show Gist options
  • Save mrwonko/3216926 to your computer and use it in GitHub Desktop.
Save mrwonko/3216926 to your computer and use it in GitHub Desktop.
some lua error catching examples
local success, message = pcall(error, "this is an error")
if not success then
print("Caught error:", message)
end
local success, message = xpcall(
error,
function(err)
return debug.traceback(err, 3)
end,
"this is an error"
)
if not success then
print("Caught error:", message)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment