-- The pcall (f, arg1, ...) function calls the requested function in
-- protected mode. If some error occurs in function f, it does not throw
-- an error. It just returns the status of error. A simple example using
-- pcall is shown below.
Live Demo
function myfunction ()
n = n/nil
end
if pcall(myfunction) then
print("Success")
else
print("Failure")
end