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