RosettaCodeData/Task/Exceptions/Lua/exceptions-3.lua
Ingy döt Net 764da6cbbb CDE
2013-04-10 16:57:12 -07:00

8 lines
274 B
Lua

function throw_error_with_argment(argument)
error(string.format("Whoops! argument = %s", argument))
-- won't ever appear, due to previous error() call
return "hello!"
end
status, errmsg = pcall(throw_error_with_argment, "foobar 123")
print("errmsg = ", errmsg)