| 1035 | |
| 1036 | |
| 1037 | LUA_API void lua_callk (lua_State *L, int nargs, int nresults, |
| 1038 | lua_KContext ctx, lua_KFunction k) { |
| 1039 | StkId func; |
| 1040 | lua_lock(L); |
| 1041 | api_check(L, k == NULL || !isLua(L->ci), |
| 1042 | "cannot use continuations inside hooks"); |
| 1043 | api_checkpop(L, nargs + 1); |
| 1044 | api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); |
| 1045 | checkresults(L, nargs, nresults); |
| 1046 | func = L->top.p - (nargs+1); |
| 1047 | if (k != NULL && yieldable(L)) { /* need to prepare continuation? */ |
| 1048 | L->ci->u.c.k = k; /* save continuation */ |
| 1049 | L->ci->u.c.ctx = ctx; /* save context */ |
| 1050 | luaD_call(L, func, nresults); /* do the call */ |
| 1051 | } |
| 1052 | else /* no continuation or no yieldable */ |
| 1053 | luaD_callnoyield(L, func, nresults); /* just do the call */ |
| 1054 | adjustresults(L, nresults); |
| 1055 | lua_unlock(L); |
| 1056 | } |
| 1057 | |
| 1058 | |
| 1059 |
no test coverage detected