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