MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / lua_pushcclosure

Function lua_pushcclosure

src/Chain/libraries/glua/lapi.cpp:535–556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 6

luaB_cowrapFunction · 0.85
createsearcherstableFunction · 0.85
gmatchFunction · 0.85
aux_linesFunction · 0.85
contract_api_wrapperFunction · 0.85
luaL_setfuncsFunction · 0.85

Calls 1

luaF_newCclosureFunction · 0.85

Tested by

no test coverage detected