summaryrefslogtreecommitdiff
path: root/src/lapi.c
diff options
context:
space:
mode:
authorLua Team <team@lua.org>2006-06-07 12:00:00 +0000
committerrepogen <>2006-06-07 12:00:00 +0000
commit72847ae02f73ea86c1a0d5778a9bc982cdccb821 (patch)
tree5dea38807cf743125087bb9f88977a39c28ceb91 /src/lapi.c
parentfc48fbdd7b265a381002c76dcf79584b919104a0 (diff)
downloadlua-github-72847ae02f73ea86c1a0d5778a9bc982cdccb821.tar.gz
Diffstat (limited to 'src/lapi.c')
-rw-r--r--src/lapi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lapi.c b/src/lapi.c
index 68e86f2e..7c532b8b 100644
--- a/src/lapi.c
+++ b/src/lapi.c
@@ -1,5 +1,5 @@
/*
-** $Id: lapi.c,v 2.54 2006/06/02 15:34:00 roberto Exp $
+** $Id: lapi.c,v 2.55 2006/06/07 12:37:17 roberto Exp $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -199,6 +199,9 @@ LUA_API void lua_insert (lua_State *L, int idx) {
LUA_API void lua_replace (lua_State *L, int idx) {
StkId o;
lua_lock(L);
+ /* explicit test for incompatible code */
+ if (idx == LUA_ENVIRONINDEX && L->ci == L->base_ci)
+ luaG_runerror(L, "no calling environment");
api_checknelems(L, 1);
o = index2adr(L, idx);
api_checkvalidindex(L, o);