public static int LuaDRawRunProtected(LuaState L, Pfunc f, object ud) { LuaLongJmp lj = new LuaLongJmp(); lj.status = 0; lj.previous = L.errorJmp; /* chain new error handler */ L.errorJmp = lj; /* * LUAI_TRY(L, lj, * f(L, ud) * ); * */ #if CATCH_EXCEPTIONS try #endif { f(L, ud); } #if CATCH_EXCEPTIONS catch { if (lj.status == 0) { lj.status = -1; } } #endif L.errorJmp = lj.previous; /* restore old error handler */ return(lj.status); }
public static int LuaDRawRunProtected(LuaState L, Pfunc f, object ud) { LuaLongJmp lj = new LuaLongJmp(); lj.status = 0; lj.previous = L.errorJmp; /* chain new error handler */ L.errorJmp = lj; /* LUAI_TRY(L, lj, f(L, ud) ); * */ try { f(L, ud); } catch { if (lj.status == 0) lj.status = -1; } L.errorJmp = lj.previous; /* restore old error handler */ return lj.status; }