MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / setfenv

Function setfenv

deps/lua/src/loadlib.c:507–516  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

505
506
507static void setfenv (lua_State *L) {
508 lua_Debug ar;
509 if (lua_getstack(L, 1, &ar) == 0 ||
510 lua_getinfo(L, "f", &ar) == 0 || /* get calling function */
511 lua_iscfunction(L, -1))
512 luaL_error(L, LUA_QL("module") " not called from a Lua function");
513 lua_pushvalue(L, -2);
514 lua_setfenv(L, -2);
515 lua_pop(L, 1);
516}
517
518
519static void dooptions (lua_State *L, int n) {

Callers 1

ll_moduleFunction · 0.85

Calls 6

lua_getstackFunction · 0.85
lua_getinfoFunction · 0.85
lua_iscfunctionFunction · 0.85
luaL_errorFunction · 0.85
lua_pushvalueFunction · 0.85
lua_setfenvFunction · 0.85

Tested by

no test coverage detected