| 454 | |
| 455 | |
| 456 | int luaD_pcall (lua_State *L, Pfunc func, void *u, |
| 457 | ptrdiff_t old_top, ptrdiff_t ef) { |
| 458 | int status; |
| 459 | unsigned short oldnCcalls = L->nCcalls; |
| 460 | ptrdiff_t old_ci = saveci(L, L->ci); |
| 461 | lu_byte old_allowhooks = L->allowhook; |
| 462 | ptrdiff_t old_errfunc = L->errfunc; |
| 463 | L->errfunc = ef; |
| 464 | status = luaD_rawrunprotected(L, func, u); |
| 465 | if (status != 0) { /* an error occurred? */ |
| 466 | StkId oldtop = restorestack(L, old_top); |
| 467 | luaF_close(L, oldtop); /* close eventual pending closures */ |
| 468 | luaD_seterrorobj(L, status, oldtop); |
| 469 | L->nCcalls = oldnCcalls; |
| 470 | L->ci = restoreci(L, old_ci); |
| 471 | L->base = L->ci->base; |
| 472 | L->savedpc = L->ci->savedpc; |
| 473 | L->allowhook = old_allowhooks; |
| 474 | restore_stack_limit(L); |
| 475 | } |
| 476 | L->errfunc = old_errfunc; |
| 477 | return status; |
| 478 | } |
| 479 | |
| 480 | |
| 481 |
no test coverage detected