Professional Documents
Culture Documents
Programming in Lua
Part I. The Language
Chapter 8. Compilation, Execution, and
Errors
function foo ()
...
...
...
end
if pcall(foo) then
...
else
...
end
else ...
Despite its name, the error message does not have to be a string.
Any Lua
value that you pass to error will be returned by pcall: