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