Created
July 31, 2012 13:07
-
-
Save mrwonko/3216926 to your computer and use it in GitHub Desktop.
some lua error catching examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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