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

Function lua_pushcclosure

third-party/lua-5.3.5/src/lapi.c:532–554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

530
531
532LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
533 lua_lock(L);
534 if (n == 0) {
535 setfvalue(L->top, fn);
536 api_incr_top(L);
537 }
538 else {
539 CClosure *cl;
540 api_checknelems(L, n);
541 api_check(L, n <= MAXUPVAL, "upvalue index too large");
542 cl = luaF_newCclosure(L, n);
543 cl->f = fn;
544 L->top -= n;
545 while (n--) {
546 setobj2n(L, &cl->upvalue[n], L->top + n);
547 /* does not need barrier because closure is white */
548 }
549 setclCvalue(L, L->top, cl);
550 api_incr_top(L);
551 luaC_checkGC(L);
552 }
553 lua_unlock(L);
554}
555
556
557LUA_API void lua_pushboolean (lua_State *L, int b) {

Callers 5

gmatchFunction · 0.70
luaL_setfuncsFunction · 0.70
luaB_cowrapFunction · 0.70
createsearcherstableFunction · 0.70
aux_linesFunction · 0.70

Calls 1

luaF_newCclosureFunction · 0.70

Tested by

no test coverage detected