| 2652 | |
| 2653 | |
| 2654 | LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { |
| 2655 | struct CallS c; |
| 2656 | int status; |
| 2657 | ptrdiff_t func; |
| 2658 | lua_lock(L); |
| 2659 | api_checknelems(L, nargs+1); |
| 2660 | checkresults(L, nargs, nresults); |
| 2661 | if (errfunc == 0) |
| 2662 | func = 0; |
| 2663 | else { |
| 2664 | StkId o = index2adr(L, errfunc); |
| 2665 | api_checkvalidindex(L, o); |
| 2666 | func = savestack(L, o); |
| 2667 | } |
| 2668 | c.func = L->top - (nargs+1); /* function to be called */ |
| 2669 | c.nresults = nresults; |
| 2670 | status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); |
| 2671 | adjustresults(L, nresults); |
| 2672 | lua_unlock(L); |
| 2673 | return status; |
| 2674 | } |
| 2675 | |
| 2676 | |
| 2677 | /* |
no test coverage detected