MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / luaB_setfenv

Function luaB_setfenv

other_src/lua/src/lbaselib.cpp:143–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141
142
143static int luaB_setfenv (lua_State *L) {
144 luaL_checktype(L, 2, LUA_TTABLE);
145 getfunc(L, 0);
146 lua_pushvalue(L, 2);
147 if (lua_isnumber(L, 1) && lua_tonumber(L, 1) == 0) {
148 /* change environment of current thread */
149 lua_pushthread(L);
150 lua_insert(L, -2);
151 lua_setfenv(L, -2);
152 return 0;
153 }
154 else if (lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0)
155 luaL_error(L,
156 LUA_QL("setfenv") " cannot change environment of given object");
157 return 1;
158}
159
160
161static int luaB_rawequal (lua_State *L) {

Callers

nothing calls this directly

Calls 10

lua_tonumberFunction · 0.85
luaL_checktypeFunction · 0.70
getfuncFunction · 0.70
lua_pushvalueFunction · 0.70
lua_isnumberFunction · 0.70
lua_pushthreadFunction · 0.70
lua_insertFunction · 0.70
lua_setfenvFunction · 0.70
lua_iscfunctionFunction · 0.70
luaL_errorFunction · 0.70

Tested by

no test coverage detected