| 904 | |
| 905 | |
| 906 | LUA_API void lua_callk (lua_State *L, int nargs, int nresults, |
| 907 | lua_KContext ctx, lua_KFunction k) { |
| 908 | StkId func; |
| 909 | lua_lock(L); |
| 910 | api_check(L, k == NULL || !isLua(L->ci), |
| 911 | "cannot use continuations inside hooks"); |
| 912 | api_checknelems(L, nargs+1); |
| 913 | api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); |
| 914 | checkresults(L, nargs, nresults); |
| 915 | func = L->top - (nargs+1); |
| 916 | if (k != NULL && L->nny == 0) { /* need to prepare continuation? */ |
| 917 | L->ci->u.c.k = k; /* save continuation */ |
| 918 | L->ci->u.c.ctx = ctx; /* save context */ |
| 919 | luaD_call(L, func, nresults); /* do the call */ |
| 920 | } |
| 921 | else /* no continuation or no yieldable */ |
| 922 | luaD_callnoyield(L, func, nresults); /* just do the call */ |
| 923 | adjustresults(L, nresults); |
| 924 | lua_unlock(L); |
| 925 | } |
| 926 | |
| 927 | |
| 928 |
no test coverage detected