MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / lua_pushcclosure

Function lua_pushcclosure

third-party/lua-5.5.0/src/lapi.c:609–633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

607
608
609LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
610 lua_lock(L);
611 if (n == 0) {
612 setfvalue(s2v(L->top.p), fn);
613 api_incr_top(L);
614 }
615 else {
616 int i;
617 CClosure *cl;
618 api_checkpop(L, n);
619 api_check(L, n <= MAXUPVAL, "upvalue index too large");
620 cl = luaF_newCclosure(L, n);
621 cl->f = fn;
622 for (i = 0; i < n; i++) {
623 setobj2n(L, &cl->upvalue[i], s2v(L->top.p - n + i));
624 /* does not need barrier because closure is white */
625 lua_assert(iswhite(cl));
626 }
627 L->top.p -= n;
628 setclCvalue(L, s2v(L->top.p), cl);
629 api_incr_top(L);
630 luaC_checkGC(L);
631 }
632 lua_unlock(L);
633}
634
635
636LUA_API void lua_pushboolean (lua_State *L, int b) {

Callers 9

gmatchFunction · 0.70
luaL_setfuncsFunction · 0.70
luaB_cowrapFunction · 0.70
createsearcherstableFunction · 0.70
aux_linesFunction · 0.70
GetFileMethod · 0.50
CreateEnvMethod · 0.50
luaL_setfuncsFunction · 0.50
luaL_setfuncsFunction · 0.50

Calls 1

luaF_newCclosureFunction · 0.70

Tested by

no test coverage detected