MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / lua_getfenv

Function lua_getfenv

Source/Misc/lua/src/lua.c:2465–2486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2463
2464
2465LUA_API void lua_getfenv (lua_State *L, int idx) {
2466StkId o;
2467lua_lock(L);
2468o = index2adr(L, idx);
2469api_checkvalidindex(L, o);
2470switch (ttype(o)) {
2471case LUA_TFUNCTION:
2472sethvalue(L, L->top, clvalue(o)->c.env);
2473break;
2474case LUA_TUSERDATA:
2475sethvalue(L, L->top, uvalue(o)->env);
2476break;
2477case LUA_TTHREAD:
2478setobj2s(L, L->top, gt(thvalue(o)));
2479break;
2480default:
2481setnilvalue(L->top);
2482break;
2483}
2484api_incr_top(L);
2485lua_unlock(L);
2486}
2487
2488
2489/*

Callers 3

luaB_getfenvFunction · 0.85
db_getfenvFunction · 0.85
aux_closeFunction · 0.85

Calls 1

index2adrFunction · 0.85

Tested by

no test coverage detected