** Call the C function 'func' in protected mode, restoring basic ** thread information ('allowhook', etc.) and in particular ** its stack level in case of errors. */
| 917 | ** its stack level in case of errors. |
| 918 | */ |
| 919 | int luaD_pcall (lua_State *L, Pfunc func, void *u, |
| 920 | ptrdiff_t old_top, ptrdiff_t ef) { |
| 921 | int status; |
| 922 | CallInfo *old_ci = L->ci; |
| 923 | lu_byte old_allowhooks = L->allowhook; |
| 924 | ptrdiff_t old_errfunc = L->errfunc; |
| 925 | L->errfunc = ef; |
| 926 | status = luaD_rawrunprotected(L, func, u); |
| 927 | if (l_unlikely(status != LUA_OK)) { /* an error occurred? */ |
| 928 | L->ci = old_ci; |
| 929 | L->allowhook = old_allowhooks; |
| 930 | status = luaD_closeprotected(L, old_top, status); |
| 931 | luaD_seterrorobj(L, status, restorestack(L, old_top)); |
| 932 | luaD_shrinkstack(L); /* restore stack size in case of overflow */ |
| 933 | } |
| 934 | L->errfunc = old_errfunc; |
| 935 | return status; |
| 936 | } |
| 937 | |
| 938 | |
| 939 |
no test coverage detected