自己百度吧
--忽律錯誤,繼續執行
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