diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-06-07 09:37:17 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-06-07 09:37:17 -0300 |
| commit | fad7582c9a3cab032c3989a1b36a2ecdf5aaa3c0 (patch) | |
| tree | 302b6a58505843180ceb446cff13c6bd5f675996 | |
| parent | a62fca1ebb0798676a11c5bda2406e36de654b6e (diff) | |
| download | lua-fad7582c9a3cab032c3989a1b36a2ecdf5aaa3c0.tar.gz lua-fad7582c9a3cab032c3989a1b36a2ecdf5aaa3c0.tar.bz2 lua-fad7582c9a3cab032c3989a1b36a2ecdf5aaa3c0.zip | |
explicit test for common error (due to compatibility issue)
| -rw-r--r-- | lapi.c | 5 |
1 files changed, 4 insertions, 1 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.53 2006/01/10 12:50:00 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.54 2006/06/02 15:34:00 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 | */ |
| @@ -199,6 +199,9 @@ LUA_API void lua_insert (lua_State *L, int idx) { | |||
| 199 | LUA_API void lua_replace (lua_State *L, int idx) { | 199 | LUA_API void lua_replace (lua_State *L, int idx) { |
| 200 | StkId o; | 200 | StkId o; |
| 201 | lua_lock(L); | 201 | lua_lock(L); |
| 202 | /* explicit test for incompatible code */ | ||
| 203 | if (idx == LUA_ENVIRONINDEX && L->ci == L->base_ci) | ||
| 204 | luaG_runerror(L, "no calling environment"); | ||
| 202 | api_checknelems(L, 1); | 205 | api_checknelems(L, 1); |
| 203 | o = index2adr(L, idx); | 206 | o = index2adr(L, idx); |
| 204 | api_checkvalidindex(L, o); | 207 | api_checkvalidindex(L, o); |
