** Call the C function 'func' in protected mode, restoring basic ** thread information ('allowhook', etc.) and in particular ** its stack level in case of errors. */
| 1079 | ** its stack level in case of errors. |
| 1080 | */ |
| 1081 | TStatus luaD_pcall (lua_State *L, Pfunc func, void *u, ptrdiff_t old_top, |
| 1082 | ptrdiff_t ef) { |
| 1083 | TStatus status; |
| 1084 | CallInfo *old_ci = L->ci; |
| 1085 | lu_byte old_allowhooks = L->allowhook; |
| 1086 | ptrdiff_t old_errfunc = L->errfunc; |
| 1087 | L->errfunc = ef; |
| 1088 | status = luaD_rawrunprotected(L, func, u); |
| 1089 | if (l_unlikely(status != LUA_OK)) { /* an error occurred? */ |
| 1090 | L->ci = old_ci; |
| 1091 | L->allowhook = old_allowhooks; |
| 1092 | status = luaD_closeprotected(L, old_top, status); |
| 1093 | luaD_seterrorobj(L, status, restorestack(L, old_top)); |
| 1094 | luaD_shrinkstack(L); /* restore stack size in case of overflow */ |
| 1095 | } |
| 1096 | L->errfunc = old_errfunc; |
| 1097 | return status; |
| 1098 | } |
| 1099 | |
| 1100 | |
| 1101 |
no test coverage detected