| 995 | |
| 996 | |
| 997 | LUA_API void lua_callk (lua_State *L, int nargs, int nresults, |
| 998 | lua_KContext ctx, lua_KFunction k) { |
| 999 | StkId func; |
| 1000 | lua_lock(L); |
| 1001 | api_check(L, k == NULL || !isLua(L->ci), |
| 1002 | "cannot use continuations inside hooks"); |
| 1003 | api_checknelems(L, nargs+1); |
| 1004 | api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); |
| 1005 | checkresults(L, nargs, nresults); |
| 1006 | func = L->top - (nargs+1); |
| 1007 | if (k != NULL && yieldable(L)) { /* need to prepare continuation? */ |
| 1008 | L->ci->u.c.k = k; /* save continuation */ |
| 1009 | L->ci->u.c.ctx = ctx; /* save context */ |
| 1010 | luaD_call(L, func, nresults); /* do the call */ |
| 1011 | } |
| 1012 | else /* no continuation or no yieldable */ |
| 1013 | luaD_callnoyield(L, func, nresults); /* just do the call */ |
| 1014 | adjustresults(L, nresults); |
| 1015 | lua_unlock(L); |
| 1016 | } |
| 1017 | |
| 1018 | |
| 1019 |
no test coverage detected