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

Function set_env

depends/lua/src/loadlib.c:634–643  ·  view source on GitHub ↗

** changes the environment variable of calling function */

Source from the content-addressed store, hash-verified

632** changes the environment variable of calling function
633*/
634static void set_env (lua_State *L) {
635 lua_Debug ar;
636 if (lua_getstack(L, 1, &ar) == 0 ||
637 lua_getinfo(L, "f", &ar) == 0 || /* get calling function */
638 lua_iscfunction(L, -1))
639 luaL_error(L, "'module' not called from a Lua function");
640 lua_pushvalue(L, -2); /* copy new environment table to top */
641 lua_setupvalue(L, -2, 1);
642 lua_pop(L, 1); /* remove function */
643}
644
645
646static 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_setupvalueFunction · 0.85

Tested by

no test coverage detected