-- Call a function that may produce an error
local success, result = pcall(function()
-- Perform some operation that may fail
return 10 / 0
end)
-- Check if the call was successful
if success then
print("Result:", result)
else
print("Error:", result)
end