MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / lua_pushcclosure

Function lua_pushcclosure

lib/lua/src/lapi.c:579–602  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

577
578
579LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
580 lua_lock(L);
581 if (n == 0) {
582 setfvalue(s2v(L->top.p), fn);
583 api_incr_top(L);
584 }
585 else {
586 CClosure *cl;
587 api_checknelems(L, n);
588 api_check(L, n <= MAXUPVAL, "upvalue index too large");
589 cl = luaF_newCclosure(L, n);
590 cl->f = fn;
591 L->top.p -= n;
592 while (n--) {
593 setobj2n(L, &cl->upvalue[n], s2v(L->top.p + n));
594 /* does not need barrier because closure is white */
595 lua_assert(iswhite(cl));
596 }
597 setclCvalue(L, s2v(L->top.p), cl);
598 api_incr_top(L);
599 luaC_checkGC(L);
600 }
601 lua_unlock(L);
602}
603
604
605LUA_API void lua_pushboolean (lua_State *L, int b) {

Callers 9

gmatchFunction · 0.85
luaL_setfuncsFunction · 0.85
luaB_cowrapFunction · 0.85
createsearcherstableFunction · 0.85
aux_linesFunction · 0.85
injectTableApiLuaMethod · 0.85
installLuaMethod · 0.85
installLuaMethod · 0.85
installLuaConsoleMethod · 0.85

Calls 1

luaF_newCclosureFunction · 0.85

Tested by

no test coverage detected