xpcall 用法
作者:互联网
local function f(x, y) print("f args: ", x, y) error("f error") -- raise error end -- 1 local function error_handler(err) print(err) return debug.traceback() end local ok, errmsg = xpcall(f, error_handler, 1, 2) if not ok then print(errmsg) end -- 2 local ok, errmsg = xpcall(f, debug.traceback, 1, 2) if not ok then print(errmsg) end
标签:ok,xpcall,用法,error,print,end,local,errmsg 来源: https://www.cnblogs.com/codingthings/p/16461436.html