** Call the C function 'func' in protected mode, restoring basic ** thread information ('allowhook', etc.) and in particular ** its stack level in case of errors. */
| 948 | ** its stack level in case of errors. |
| 949 | */ |
| 950 | int luaD_pcall (lua_State *L, Pfunc func, void *u, |
| 951 | ptrdiff_t old_top, ptrdiff_t ef) { |
| 952 | int status; |
| 953 | CallInfo *old_ci = L->ci; |
| 954 | lu_byte old_allowhooks = L->allowhook; |
| 955 | ptrdiff_t old_errfunc = L->errfunc; |
| 956 | L->errfunc = ef; |
| 957 | status = luaD_rawrunprotected(L, func, u); |
| 958 | if (l_unlikely(status != LUA_OK)) { /* an error occurred? */ |
| 959 | L->ci = old_ci; |
| 960 | L->allowhook = old_allowhooks; |
| 961 | status = luaD_closeprotected(L, old_top, status); |
| 962 | luaD_seterrorobj(L, status, restorestack(L, old_top)); |
| 963 | luaD_shrinkstack(L); /* restore stack size in case of overflow */ |
| 964 | } |
| 965 | L->errfunc = old_errfunc; |
| 966 | return status; |
| 967 | } |
| 968 | |
| 969 | |
| 970 |
no test coverage detected