PDA

View Full Version : Protected Calls in LUA - an example of error handling



Promixis
September 18th, 2003, 12:42 PM
function ProtectedCall (f, ...)
return call(f, arg, "x", function (msg) %arg.msg = msg end) or nil, arg.msg
end

res,err = ProtectedCall (round,"fff55.666",0)
print (res or err)

res,err = ProtectedCall (round,"55.666",1)
print (res or err)