| 884 | |
| 885 | |
| 886 | LUA_API void lua_callk (lua_State *L, int nargs, int nresults, int ctx, |
| 887 | lua_CFunction k) { |
| 888 | StkId func; |
| 889 | lua_lock(L); |
| 890 | api_check(L, k == NULL || !isLua(L->ci), |
| 891 | "cannot use continuations inside hooks"); |
| 892 | api_checknelems(L, nargs+1); |
| 893 | api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); |
| 894 | checkresults(L, nargs, nresults); |
| 895 | func = L->top - (nargs+1); |
| 896 | if (k != NULL && L->nny == 0) { /* need to prepare continuation? */ |
| 897 | L->ci->u.c.k = k; /* save continuation */ |
| 898 | L->ci->u.c.ctx = ctx; /* save context */ |
| 899 | luaD_call(L, func, nresults, 1); /* do the call */ |
| 900 | } |
| 901 | else /* no continuation or no yieldable */ |
| 902 | luaD_call(L, func, nresults, 0); /* just do the call */ |
| 903 | adjustresults(L, nresults); |
| 904 | lua_unlock(L); |
| 905 | } |
| 906 | |
| 907 | |
| 908 |
nothing calls this directly
no test coverage detected