summaryrefslogtreecommitdiff
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-github-5cd99b82b7fc11c527929e5e95f03767f6432d8e.tar.gz
`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 @@
/*
-** $Id: lapi.c,v 1.229 2003/02/18 16:13:15 roberto Exp roberto $
+** $Id: lapi.c,v 1.230 2003/02/20 19:33:23 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -542,7 +542,7 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) {
}
-LUA_API void lua_getenvtable (lua_State *L, int index) {
+LUA_API void lua_getfenv (lua_State *L, int index) {
StkId o;
lua_lock(L);
o = luaA_index(L, index);
@@ -620,7 +620,7 @@ LUA_API int lua_setmetatable (lua_State *L, int objindex) {
}
-LUA_API int lua_setenvtable (lua_State *L, int index) {
+LUA_API int lua_setfenv (lua_State *L, int index) {
StkId o;
int res = 0;
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 @@
/*
-** $Id: lbaselib.c,v 1.121 2003/02/18 16:13:15 roberto Exp roberto $
+** $Id: lbaselib.c,v 1.122 2003/02/24 16:50:41 roberto Exp roberto $
** Basic library
** See Copyright Notice in lua.h
*/
@@ -127,31 +127,31 @@ static void getfunc (lua_State *L) {
}
-static int aux_getenvtable (lua_State *L) {
- lua_getenvtable(L, -1);
+static int aux_getfenv (lua_State *L) {
+ lua_getfenv(L, -1);
lua_pushliteral(L, "__globals");
lua_rawget(L, -2);
return !lua_isnil(L, -1);
}
-static int luaB_getenvtable (lua_State *L) {
+static int luaB_getfenv (lua_State *L) {
getfunc(L);
- if (!aux_getenvtable(L)) /* __globals not defined? */
+ if (!aux_getfenv(L)) /* __globals not defined? */
lua_pop(L, 1); /* remove it, to return real environment */
return 1;
}
-static int luaB_setenvtable (lua_State *L) {
+static int luaB_setfenv (lua_State *L) {
luaL_checktype(L, 2, LUA_TTABLE);
getfunc(L);
- if (aux_getenvtable(L)) /* __globals defined? */
+ if (aux_getfenv(L)) /* __globals defined? */
luaL_error(L, "cannot change a protected global table");
else
lua_pop(L, 2); /* remove __globals and real environment table */
lua_pushvalue(L, 2);
- if (lua_setenvtable(L, -2) == 0)
+ if (lua_setfenv(L, -2) == 0)
luaL_error(L, "cannot change environment of given function");
return 0;
}
@@ -247,8 +247,8 @@ static int load_aux (lua_State *L, int status) {
lua_Debug ar;
lua_getstack(L, 1, &ar);
lua_getinfo(L, "f", &ar); /* get calling function */
- lua_getenvtable(L, -1); /* get its environment */
- lua_setenvtable(L, -3); /* set it as the environment of the new chunk */
+ lua_getfenv(L, -1); /* get its environment */
+ lua_setfenv(L, -3); /* set it as the environment of the new chunk */
lua_pop(L, 1); /* remove calling function */
return 1;
}
@@ -499,8 +499,8 @@ static const luaL_reg base_funcs[] = {
{"error", luaB_error},
{"getmetatable", luaB_getmetatable},
{"setmetatable", luaB_setmetatable},
- {"getenvtable", luaB_getenvtable},
- {"setenvtable", luaB_setenvtable},
+ {"getfenv", luaB_getfenv},
+ {"setfenv", luaB_setfenv},
{"next", luaB_next},
{"ipairs", luaB_ipairs},
{"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 @@
/*
-** $Id: lua.h,v 1.171 2003/02/18 16:01:57 roberto Exp roberto $
+** $Id: lua.h,v 1.172 2003/02/18 16:13:15 roberto Exp roberto $
** Lua - An Extensible Extension Language
** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
** http://www.lua.org mailto:info@lua.org
@@ -168,7 +168,7 @@ LUA_API void lua_rawget (lua_State *L, int idx);
LUA_API void lua_rawgeti (lua_State *L, int idx, int n);
LUA_API void lua_newtable (lua_State *L);
LUA_API int lua_getmetatable (lua_State *L, int objindex);
-LUA_API void lua_getenvtable (lua_State *L, int idx);
+LUA_API void lua_getfenv (lua_State *L, int idx);
/*
@@ -178,7 +178,7 @@ LUA_API void lua_settable (lua_State *L, int idx);
LUA_API void lua_rawset (lua_State *L, int idx);
LUA_API void lua_rawseti (lua_State *L, int idx, int n);
LUA_API int lua_setmetatable (lua_State *L, int objindex);
-LUA_API int lua_setenvtable (lua_State *L, int idx);
+LUA_API int lua_setfenv (lua_State *L, int idx);
/*