github.com/hirochachacha/plua@v0.0.0-20170217012138-c82f520cc725/stdlib/base/testdata/xpcall.lua (about) 1 function f() error("error") end 2 function g(x) return x end 3 ok, err = xpcall(f, g) 4 assert(not ok and (err == "testdata/xpcall.lua:1: error" or err == "testdata\\xpcall.lua:1: error")) 5 6 function g2(x) error(x) end 7 ok, err = xpcall(f, g2) 8 assert(not ok and (err == "testdata/xpcall.lua:6: error in error handling" or err == "testdata\\xpcall.lua:6: error in error handling")) 9 10 function f() return 1, 2 end 11 12 ok, x, y = xpcall(f, g2) 13 assert(ok and x == 1 and y == 2)