'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

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 */
}