diff options
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.73 2009/03/30 18:39:20 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.74 2009/04/08 18:04:33 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -72,7 +72,7 @@ static TValue *index2adr (lua_State *L, int idx) { | |||
72 | 72 | ||
73 | 73 | ||
74 | static Table *getcurrenv (lua_State *L) { | 74 | static Table *getcurrenv (lua_State *L) { |
75 | if (L->ci == L->base_ci) /* no enclosing function? */ | 75 | if (L->ci->previous == NULL) /* no enclosing function? */ |
76 | return hvalue(gt(L)); /* use global table as environment */ | 76 | return hvalue(gt(L)); /* use global table as environment */ |
77 | else { | 77 | else { |
78 | Closure *func = curr_func(L); | 78 | Closure *func = curr_func(L); |
@@ -185,7 +185,7 @@ LUA_API void lua_replace (lua_State *L, int idx) { | |||
185 | StkId o; | 185 | StkId o; |
186 | lua_lock(L); | 186 | lua_lock(L); |
187 | /* explicit test for incompatible code */ | 187 | /* explicit test for incompatible code */ |
188 | if (idx == LUA_ENVIRONINDEX && L->ci == L->base_ci) | 188 | if (idx == LUA_ENVIRONINDEX && L->ci->previous == NULL) |
189 | luaG_runerror(L, "no calling environment"); | 189 | luaG_runerror(L, "no calling environment"); |
190 | api_checknelems(L, 1); | 190 | api_checknelems(L, 1); |
191 | o = index2adr(L, idx); | 191 | o = index2adr(L, idx); |