Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR LUA

lua catch error

-- 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
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #lua #catch #error
ADD COMMENT
Topic
Name
7+5 =