aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-02-24 13:54:20 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-02-24 13:54:20 -0300
commit5cd99b82b7fc11c527929e5e95f03767f6432d8e (patch)
treedc5e5dfb1731701dc91d14777d6e0e446324b4d6
parent07e210e6555b9930edc2f2fb21220f6f6769f110 (diff)
downloadlua-5cd99b82b7fc11c527929e5e95f03767f6432d8e.tar.gz
lua-5cd99b82b7fc11c527929e5e95f03767f6432d8e.tar.bz2
lua-5cd99b82b7fc11c527929e5e95f03767f6432d8e.zip
`set/getenvtable' -> `set/getfenv'
-rw-r--r--lapi.c6
-rw-r--r--lbaselib.c24
-rw-r--r--lua.h6
3 files changed, 18 insertions, 18 deletions
diff --git a/lapi.c b/lapi.c
index 74df3410..7edba827 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 1.229 2003/02/18 16:13:15 roberto Exp roberto $ 2** $Id: lapi.c,v 1.230 2003/02/20 19:33:23 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -542,7 +542,7 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) {
542} 542}
543 543
544 544
545LUA_API void lua_getenvtable (lua_State *L, int index) { 545LUA_API void lua_getfenv (lua_State *L, int index) {
546 StkId o; 546 StkId o;
547 lua_lock(L); 547 lua_lock(L);
548 o = luaA_index(L, index); 548 o = luaA_index(L, index);
@@ -620,7 +620,7 @@ LUA_API int lua_setmetatable (lua_State *L, int objindex) {
620} 620}
621 621
622 622
623LUA_API int lua_setenvtable (lua_State *L, int index) { 623LUA_API int lua_setfenv (lua_State *L, int index) {
624 StkId o; 624 StkId o;
625 int res = 0; 625 int res = 0;
626 lua_lock(L); 626 lua_lock(L);
diff --git a/lbaselib.c b/lbaselib.c
index dac9fb23..7bf69c8f 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.121 2003/02/18 16:13:15 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.122 2003/02/24 16:50:41 roberto Exp roberto $
3** Basic library 3** Basic library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -127,31 +127,31 @@ static void getfunc (lua_State *L) {
127} 127}
128 128
129 129
130static int aux_getenvtable (lua_State *L) { 130static int aux_getfenv (lua_State *L) {
131 lua_getenvtable(L, -1); 131 lua_getfenv(L, -1);
132 lua_pushliteral(L, "__globals"); 132 lua_pushliteral(L, "__globals");
133 lua_rawget(L, -2); 133 lua_rawget(L, -2);
134 return !lua_isnil(L, -1); 134 return !lua_isnil(L, -1);
135} 135}
136 136
137 137
138static int luaB_getenvtable (lua_State *L) { 138static int luaB_getfenv (lua_State *L) {
139 getfunc(L); 139 getfunc(L);
140 if (!aux_getenvtable(L)) /* __globals not defined? */ 140 if (!aux_getfenv(L)) /* __globals not defined? */
141 lua_pop(L, 1); /* remove it, to return real environment */ 141 lua_pop(L, 1); /* remove it, to return real environment */
142 return 1; 142 return 1;
143} 143}
144 144
145 145
146static int luaB_setenvtable (lua_State *L) { 146static int luaB_setfenv (lua_State *L) {
147 luaL_checktype(L, 2, LUA_TTABLE); 147 luaL_checktype(L, 2, LUA_TTABLE);
148 getfunc(L); 148 getfunc(L);
149 if (aux_getenvtable(L)) /* __globals defined? */ 149 if (aux_getfenv(L)) /* __globals defined? */
150 luaL_error(L, "cannot change a protected global table"); 150 luaL_error(L, "cannot change a protected global table");
151 else 151 else
152 lua_pop(L, 2); /* remove __globals and real environment table */ 152 lua_pop(L, 2); /* remove __globals and real environment table */
153 lua_pushvalue(L, 2); 153 lua_pushvalue(L, 2);
154 if (lua_setenvtable(L, -2) == 0) 154 if (lua_setfenv(L, -2) == 0)
155 luaL_error(L, "cannot change environment of given function"); 155 luaL_error(L, "cannot change environment of given function");
156 return 0; 156 return 0;
157} 157}
@@ -247,8 +247,8 @@ static int load_aux (lua_State *L, int status) {
247 lua_Debug ar; 247 lua_Debug ar;
248 lua_getstack(L, 1, &ar); 248 lua_getstack(L, 1, &ar);
249 lua_getinfo(L, "f", &ar); /* get calling function */ 249 lua_getinfo(L, "f", &ar); /* get calling function */
250 lua_getenvtable(L, -1); /* get its environment */ 250 lua_getfenv(L, -1); /* get its environment */
251 lua_setenvtable(L, -3); /* set it as the environment of the new chunk */ 251 lua_setfenv(L, -3); /* set it as the environment of the new chunk */
252 lua_pop(L, 1); /* remove calling function */ 252 lua_pop(L, 1); /* remove calling function */
253 return 1; 253 return 1;
254 } 254 }
@@ -499,8 +499,8 @@ static const luaL_reg base_funcs[] = {
499 {"error", luaB_error}, 499 {"error", luaB_error},
500 {"getmetatable", luaB_getmetatable}, 500 {"getmetatable", luaB_getmetatable},
501 {"setmetatable", luaB_setmetatable}, 501 {"setmetatable", luaB_setmetatable},
502 {"getenvtable", luaB_getenvtable}, 502 {"getfenv", luaB_getfenv},
503 {"setenvtable", luaB_setenvtable}, 503 {"setfenv", luaB_setfenv},
504 {"next", luaB_next}, 504 {"next", luaB_next},
505 {"ipairs", luaB_ipairs}, 505 {"ipairs", luaB_ipairs},
506 {"pairs", luaB_pairs}, 506 {"pairs", luaB_pairs},
diff --git a/lua.h b/lua.h
index 2efb7125..ed5bb614 100644
--- a/lua.h
+++ b/lua.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.h,v 1.171 2003/02/18 16:01:57 roberto Exp roberto $ 2** $Id: lua.h,v 1.172 2003/02/18 16:13:15 roberto Exp roberto $
3** Lua - An Extensible Extension Language 3** Lua - An Extensible Extension Language
4** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil 4** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
5** http://www.lua.org mailto:info@lua.org 5** http://www.lua.org mailto:info@lua.org
@@ -168,7 +168,7 @@ LUA_API void lua_rawget (lua_State *L, int idx);
168LUA_API void lua_rawgeti (lua_State *L, int idx, int n); 168LUA_API void lua_rawgeti (lua_State *L, int idx, int n);
169LUA_API void lua_newtable (lua_State *L); 169LUA_API void lua_newtable (lua_State *L);
170LUA_API int lua_getmetatable (lua_State *L, int objindex); 170LUA_API int lua_getmetatable (lua_State *L, int objindex);
171LUA_API void lua_getenvtable (lua_State *L, int idx); 171LUA_API void lua_getfenv (lua_State *L, int idx);
172 172
173 173
174/* 174/*
@@ -178,7 +178,7 @@ LUA_API void lua_settable (lua_State *L, int idx);
178LUA_API void lua_rawset (lua_State *L, int idx); 178LUA_API void lua_rawset (lua_State *L, int idx);
179LUA_API void lua_rawseti (lua_State *L, int idx, int n); 179LUA_API void lua_rawseti (lua_State *L, int idx, int n);
180LUA_API int lua_setmetatable (lua_State *L, int objindex); 180LUA_API int lua_setmetatable (lua_State *L, int objindex);
181LUA_API int lua_setenvtable (lua_State *L, int idx); 181LUA_API int lua_setfenv (lua_State *L, int idx);
182 182
183 183
184/* 184/*