MCPcopy Create free account
hub / github.com/Overload-Technologies/Overload / lua_pushcclosure

Function lua_pushcclosure

Dependencies/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 15

selectFunction · 0.85
set_undefined_methods_onFunction · 0.85
pushMethod · 0.85
pushMethod · 0.85
pushMethod · 0.85
pushMethod · 0.85
pushMethod · 0.85
push_withMethod · 0.85
setMethod · 0.85
luaL_setfuncsFunction · 0.85
gmatchFunction · 0.85
runCFunction · 0.85

Calls 1

luaF_newCclosureFunction · 0.85

Tested by 2

runCFunction · 0.68
makeCfuncFunction · 0.68