diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-09-07 16:38:36 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-09-07 16:38:36 -0300 |
commit | a289a62717219810cf3ebb28c513af671aecfeac (patch) | |
tree | 0b30b511c292aea46e86984b81dddaf1102dbbb5 | |
parent | e3eabcf9134c0362facffde0305c18d992375913 (diff) | |
download | lua-a289a62717219810cf3ebb28c513af671aecfeac.tar.gz lua-a289a62717219810cf3ebb28c513af671aecfeac.tar.bz2 lua-a289a62717219810cf3ebb28c513af671aecfeac.zip |
'loadin' should not check whether upvalue is called '_ENV',
because its name may be unknown when there is no debug information.
-rw-r--r-- | lbaselib.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.248 2010/09/03 14:14:01 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.249 2010/09/07 19:21:39 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 | */ |
@@ -333,11 +333,9 @@ static int luaB_loadin (lua_State *L) { | |||
333 | luaL_checkany(L, 1); | 333 | luaL_checkany(L, 1); |
334 | n = luaB_load_aux(L, 2); | 334 | n = luaB_load_aux(L, 2); |
335 | if (n == 1) { /* success? */ | 335 | if (n == 1) { /* success? */ |
336 | const char *name; | ||
337 | lua_pushvalue(L, 1); /* environment for loaded function */ | 336 | lua_pushvalue(L, 1); /* environment for loaded function */ |
338 | name = lua_setupvalue(L, -2, 1); | 337 | if (lua_setupvalue(L, -2, 1) == NULL) |
339 | if (name == NULL || strcmp(name, LUA_ENV) != 0) | 338 | luaL_error(L, "loaded chunk does not have an upvalue"); |
340 | luaL_error(L, "loaded chunk does not have environment upvalue"); | ||
341 | } | 339 | } |
342 | return n; | 340 | return n; |
343 | } | 341 | } |