| 803 | |
| 804 | |
| 805 | LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { |
| 806 | struct CallS c; |
| 807 | int status; |
| 808 | ptrdiff_t func; |
| 809 | lua_lock(L); |
| 810 | api_checknelems(L, nargs+1); |
| 811 | checkresults(L, nargs, nresults); |
| 812 | if (errfunc == 0) |
| 813 | func = 0; |
| 814 | else { |
| 815 | StkId o = index2adr(L, errfunc); |
| 816 | api_checkvalidindex(L, o); |
| 817 | func = savestack(L, o); |
| 818 | } |
| 819 | c.func = L->top - (nargs+1); /* function to be called */ |
| 820 | c.nresults = nresults; |
| 821 | status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); |
| 822 | adjustresults(L, nresults); |
| 823 | lua_unlock(L); |
| 824 | return status; |
| 825 | } |
| 826 | |
| 827 | |
| 828 | /* |
no test coverage detected