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