From 50f9cd201e34f3464362a63c54207fff963507d0 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 2 Jun 2004 11:20:08 -0300 Subject: no more `__fenv' --- lbaselib.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'lbaselib.c') diff --git a/lbaselib.c b/lbaselib.c index 6ce9f18e..a4c3db6f 100644 --- 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); -- cgit v1.2.3-55-g6feb