aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lbaselib.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lbaselib.c b/lbaselib.c
index aa9a6f1e..aea02d47 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.145 2004/06/02 14:20:08 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.146 2004/06/04 15:30:53 roberto Exp roberto $
3** Basic library 3** Basic library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -140,11 +140,13 @@ static int luaB_setfenv (lua_State *L) {
140 luaL_checktype(L, 2, LUA_TTABLE); 140 luaL_checktype(L, 2, LUA_TTABLE);
141 getfunc(L); 141 getfunc(L);
142 lua_pushvalue(L, 2); 142 lua_pushvalue(L, 2);
143 if (lua_isnumber(L, 1) && lua_tonumber(L, 1) == 0) 143 if (lua_isnumber(L, 1) && lua_tonumber(L, 1) == 0) {
144 lua_replace(L, LUA_GLOBALSINDEX); 144 lua_replace(L, LUA_GLOBALSINDEX);
145 return 0;
146 }
145 else if (lua_setfenv(L, -2) == 0) 147 else if (lua_setfenv(L, -2) == 0)
146 luaL_error(L, "`setfenv' cannot change environment of given function"); 148 luaL_error(L, "`setfenv' cannot change environment of given function");
147 return 0; 149 return 1;
148} 150}
149 151
150 152