MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / lua_callk

Function lua_callk

3rd/lua-5.4.3/src/lapi.c:997–1016  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

995
996
997LUA_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

Callers 1

luaB_dofileFunction · 0.85

Calls 2

luaD_callFunction · 0.85
luaD_callnoyieldFunction · 0.85

Tested by

no test coverage detected