'lua_[gs]etenv' -> 'lua_[gs]etuservalue'

This commit is contained in:
Roberto Ierusalimschy 2010-07-25 12:18:19 -03:00
parent 73b0a3451d
commit 8b7cf8c62d
4 changed files with 17 additions and 17 deletions

6
lapi.c
View File

@ -1,5 +1,5 @@
/*
** $Id: lapi.c,v 2.131 2010/06/04 13:05:29 roberto Exp roberto $
** $Id: lapi.c,v 2.132 2010/07/02 17:35:06 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@ -644,7 +644,7 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) {
}
LUA_API void lua_getenv (lua_State *L, int idx) {
LUA_API void lua_getuservalue (lua_State *L, int idx) {
StkId o;
lua_lock(L);
o = index2addr(L, idx);
@ -754,7 +754,7 @@ LUA_API int lua_setmetatable (lua_State *L, int objindex) {
}
LUA_API void lua_setenv (lua_State *L, int idx) {
LUA_API void lua_setuservalue (lua_State *L, int idx) {
StkId o;
lua_lock(L);
api_checknelems(L, 1);

View File

@ -1,5 +1,5 @@
/*
** $Id: ldblib.c,v 1.122 2010/06/21 16:30:12 roberto Exp roberto $
** $Id: ldblib.c,v 1.123 2010/07/02 11:38:13 roberto Exp roberto $
** Interface from Lua to its debug API
** See Copyright Notice in lua.h
*/
@ -44,19 +44,19 @@ static int db_setmetatable (lua_State *L) {
}
static int db_getenv (lua_State *L) {
static int db_getuservalue (lua_State *L) {
luaL_checktype(L, 1, LUA_TUSERDATA);
lua_getenv(L, 1);
lua_getuservalue(L, 1);
return 1;
}
static int db_setenv (lua_State *L) {
static int db_setuservalue (lua_State *L) {
luaL_checktype(L, 1, LUA_TUSERDATA);
if (!lua_isnoneornil(L, 2))
luaL_checktype(L, 2, LUA_TTABLE);
lua_settop(L, 2);
lua_setenv(L, 1);
lua_setuservalue(L, 1);
return 1;
}
@ -375,7 +375,7 @@ static int db_traceback (lua_State *L) {
static const luaL_Reg dblib[] = {
{"debug", db_debug},
{"getenv", db_getenv},
{"getuservalue", db_getuservalue},
{"gethook", db_gethook},
{"getinfo", db_getinfo},
{"getlocal", db_getlocal},
@ -384,7 +384,7 @@ static const luaL_Reg dblib[] = {
{"getupvalue", db_getupvalue},
{"upvaluejoin", db_upvaluejoin},
{"upvalueid", db_upvalueid},
{"setenv", db_setenv},
{"setuservalue", db_setuservalue},
{"sethook", db_sethook},
{"setlocal", db_setlocal},
{"setmetatable", db_setmetatable},

View File

@ -1,5 +1,5 @@
/*
** $Id: liolib.c,v 2.88 2010/03/26 20:58:11 roberto Exp roberto $
** $Id: liolib.c,v 2.89 2010/07/02 11:38:13 roberto Exp roberto $
** Standard I/O (and system) library
** See Copyright Notice in lua.h
*/
@ -120,7 +120,7 @@ static FILE **newprefile (lua_State *L) {
static FILE **newfile (lua_State *L) {
FILE **pf = newprefile(L);
lua_pushvalue(L, lua_upvalueindex(1)); /* set upvalue... */
lua_setenv(L, -2); /* ... as environment for new file */
lua_setuservalue(L, -2); /* ... as environment for new file */
return pf;
}
@ -163,7 +163,7 @@ static int io_fclose (lua_State *L) {
static int aux_close (lua_State *L) {
lua_getenv(L, 1);
lua_getuservalue(L, 1);
lua_getfield(L, -1, "__close");
return (lua_tocfunction(L, -1))(L);
}
@ -595,7 +595,7 @@ static void createstdfile (lua_State *L, FILE *f, int k, const char *fname) {
lua_rawseti(L, 1, k); /* add it to common upvalue */
}
lua_pushvalue(L, 3); /* get environment for default files */
lua_setenv(L, -2); /* set it as environment for file */
lua_setuservalue(L, -2); /* set it as environment for file */
lua_setfield(L, 2, fname); /* add file to module */
}

6
lua.h
View File

@ -1,5 +1,5 @@
/*
** $Id: lua.h,v 1.271 2010/07/02 12:01:53 roberto Exp roberto $
** $Id: lua.h,v 1.272 2010/07/25 15:02:41 roberto Exp roberto $
** Lua - A Scripting Language
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
** See Copyright Notice at the end of this file
@ -217,7 +217,7 @@ LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n);
LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec);
LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);
LUA_API int (lua_getmetatable) (lua_State *L, int objindex);
LUA_API void (lua_getenv) (lua_State *L, int idx);
LUA_API void (lua_getuservalue) (lua_State *L, int idx);
/*
@ -228,7 +228,7 @@ LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k);
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 void (lua_setenv) (lua_State *L, int idx);
LUA_API void (lua_setuservalue) (lua_State *L, int idx);
/*