MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / set_env

Function set_env

third-party/lua-5.2.4/src/loadlib.c:546–555  ·  view source on GitHub ↗

** changes the environment variable of calling function */

Source from the content-addressed store, hash-verified

544** changes the environment variable of calling function
545*/
546static void set_env (lua_State *L) {
547 lua_Debug ar;
548 if (lua_getstack(L, 1, &ar) == 0 ||
549 lua_getinfo(L, "f", &ar) == 0 || /* get calling function */
550 lua_iscfunction(L, -1))
551 luaL_error(L, LUA_QL("module") " not called from a Lua function");
552 lua_pushvalue(L, -2); /* copy new environment table to top */
553 lua_setupvalue(L, -2, 1);
554 lua_pop(L, 1); /* remove function */
555}
556
557
558static void dooptions (lua_State *L, int n) {

Callers 1

ll_moduleFunction · 0.70

Calls 6

lua_getstackFunction · 0.70
lua_getinfoFunction · 0.70
lua_iscfunctionFunction · 0.70
luaL_errorFunction · 0.70
lua_pushvalueFunction · 0.70
lua_setupvalueFunction · 0.70

Tested by

no test coverage detected