MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / lua_getfenv

Function lua_getfenv

lua/lapi.c:623–644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

621
622
623LUA_API void lua_getfenv (lua_State *L, int idx) {
624 StkId o;
625 lua_lock(L);
626 o = index2adr(L, idx);
627 api_checkvalidindex(L, o);
628 switch (ttype(o)) {
629 case LUA_TFUNCTION:
630 sethvalue(L, L->top, clvalue(o)->c.env);
631 break;
632 case LUA_TUSERDATA:
633 sethvalue(L, L->top, uvalue(o)->env);
634 break;
635 case LUA_TTHREAD:
636 setobj2s(L, L->top, gt(thvalue(o)));
637 break;
638 default:
639 setnilvalue(L->top);
640 break;
641 }
642 api_incr_top(L);
643 lua_unlock(L);
644}
645
646
647/*

Callers 3

luaB_getfenvFunction · 0.85
aux_closeFunction · 0.85
db_getfenvFunction · 0.85

Calls 1

index2adrFunction · 0.85

Tested by

no test coverage detected