| 961 | |
| 962 | |
| 963 | LUA_API void lua_callk (lua_State *L, int nargs, int nresults, |
| 964 | lua_KContext ctx, lua_KFunction k) { |
| 965 | StkId func; |
| 966 | lua_lock(L); |
| 967 | api_check(L, k == NULL || !isLua(L->ci), |
| 968 | "cannot use continuations inside hooks"); |
| 969 | api_checknelems(L, nargs+1); |
| 970 | api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); |
| 971 | checkresults(L, nargs, nresults); |
| 972 | func = L->top - (nargs+1); |
| 973 | if (k != NULL && yieldable(L)) { /* need to prepare continuation? */ |
| 974 | L->ci->u.c.k = k; /* save continuation */ |
| 975 | L->ci->u.c.ctx = ctx; /* save context */ |
| 976 | luaD_call(L, func, nresults); /* do the call */ |
| 977 | } |
| 978 | else /* no continuation or no yieldable */ |
| 979 | luaD_callnoyield(L, func, nresults); /* just do the call */ |
| 980 | adjustresults(L, nresults); |
| 981 | lua_unlock(L); |
| 982 | } |
| 983 | |
| 984 | |
| 985 |
no test coverage detected