| 835 | |
| 836 | |
| 837 | LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { |
| 838 | struct CallS c; |
| 839 | int status; |
| 840 | ptrdiff_t func; |
| 841 | lua_lock(L); |
| 842 | api_checknelems(L, nargs+1); |
| 843 | checkresults(L, nargs, nresults); |
| 844 | if (errfunc == 0) { |
| 845 | func = 0; |
| 846 | } |
| 847 | else if (errfunc == LUA_REGISTRYINDEX) { |
| 848 | func = -1; |
| 849 | } |
| 850 | else { |
| 851 | StkId o = index2adr(L, errfunc); |
| 852 | api_checkvalidindex(L, o); |
| 853 | func = savestack(L, o); |
| 854 | } |
| 855 | c.func = L->top - (nargs+1); /* function to be called */ |
| 856 | c.nresults = nresults; |
| 857 | status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); |
| 858 | adjustresults(L, nresults); |
| 859 | lua_unlock(L); |
| 860 | return status; |
| 861 | } |
| 862 | |
| 863 | |
| 864 | /* |
no test coverage detected