MCPcopy Create free account
hub / github.com/DFHack/dfhack / lua_pushcclosure

Function lua_pushcclosure

depends/lua/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 15

dfhack_cowrapFunction · 0.85
dfhack_curryFunction · 0.85
PushFunctionWrapperMethod · 0.85
AddFieldInfoTableFunction · 0.85
dfhack_pen_pairsFunction · 0.85
dfhack_random_perlinFunction · 0.85
open_luaMethod · 0.85
push_functionMethod · 0.85
SetPtrMethodsMethod · 0.85
SetPairsMethodMethod · 0.85
PushStructMethodMethod · 0.85
PushContainerMethodMethod · 0.85

Calls 1

luaF_newCclosureFunction · 0.85

Tested by

no test coverage detected