自己百度吧
--忽律错误,继续执行
function test1()
pcall(
function()
print(d[1]); --d,table并不存在
end)
print("OK");
end
test1()
--忽律错误,友好显示错误,并继续执行
function test()
print(d[1]); --d,table并不存在
end
local status, errors = pcall(test);
if status then
print("正常");
else
print("函数出错了");
print(errors);
end