lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 50f9cd201e34f3464362a63c54207fff963507d0
parent 9d8426bab445935bb0c08f2ecefb2e208dc38747
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Wed,  2 Jun 2004 11:19:46 -0300

no more `__fenv'

Diffstat:
Mlbaselib.c | 17++---------------
1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/lbaselib.c b/lbaselib.c @@ -1,5 +1,5 @@ /* -** $Id: lbaselib.c,v 1.143 2004/05/10 17:50:51 roberto Exp roberto $ +** $Id: lbaselib.c,v 1.144 2004/05/31 18:50:30 roberto Exp roberto $ ** Basic library ** See Copyright Notice in lua.h */ @@ -129,18 +129,9 @@ static void getfunc (lua_State *L) { } -static int aux_getfenv (lua_State *L) { - lua_getfenv(L, -1); - lua_pushliteral(L, "__fenv"); - lua_rawget(L, -2); - return !lua_isnil(L, -1); -} - - static int luaB_getfenv (lua_State *L) { getfunc(L); - if (!aux_getfenv(L)) /* __fenv not defined? */ - lua_pop(L, 1); /* remove it, to return real environment */ + lua_getfenv(L, -1); return 1; } @@ -148,10 +139,6 @@ static int luaB_getfenv (lua_State *L) { static int luaB_setfenv (lua_State *L) { luaL_checktype(L, 2, LUA_TTABLE); getfunc(L); - if (aux_getfenv(L)) /* __fenv defined? */ - luaL_error(L, "`setfenv' cannot change a protected environment"); - else - lua_pop(L, 2); /* remove __fenv and real environment table */ lua_pushvalue(L, 2); if (lua_isnumber(L, 1) && lua_tonumber(L, 1) == 0) lua_replace(L, LUA_GLOBALSINDEX);