|
|
@ -1,5 +1,5 @@ |
|
|
|
/*
|
|
|
|
** $Id: lbaselib.c,v 1.145 2004/06/02 14:20:08 roberto Exp roberto $ |
|
|
|
** $Id: lbaselib.c,v 1.146 2004/06/04 15:30:53 roberto Exp roberto $ |
|
|
|
** Basic library |
|
|
|
** See Copyright Notice in lua.h |
|
|
|
*/ |
|
|
@ -140,11 +140,13 @@ static int luaB_setfenv (lua_State *L) { |
|
|
|
luaL_checktype(L, 2, LUA_TTABLE); |
|
|
|
getfunc(L); |
|
|
|
lua_pushvalue(L, 2); |
|
|
|
if (lua_isnumber(L, 1) && lua_tonumber(L, 1) == 0) |
|
|
|
if (lua_isnumber(L, 1) && lua_tonumber(L, 1) == 0) { |
|
|
|
lua_replace(L, LUA_GLOBALSINDEX); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
else if (lua_setfenv(L, -2) == 0) |
|
|
|
luaL_error(L, "`setfenv' cannot change environment of given function"); |
|
|
|
return 0; |
|
|
|
return 1; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|