diff options
author | Bardur Arantsson <bardur@scientician.net> | 2010-02-04 10:37:09 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2010-02-04 10:44:17 +0100 |
commit | e58eebd62c4076fcce0560e5360d43dd9c3d7d9e (patch) | |
tree | 09adee0343dd89400e973e1043acf6bac7dea70a /src/lua | |
parent | 655308482200fb624b51246b50aa6866750e9c78 (diff) |
Apply patch from Wiki bug report #615.
Thanks to Kernigh for the fix.
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lapi.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lua/lapi.c b/src/lua/lapi.c index 7be0ebfe..b597e00a 100644 --- a/src/lua/lapi.c +++ b/src/lua/lapi.c @@ -40,12 +40,17 @@ TObject *luaA_index (lua_State *L, int index) { static TObject *luaA_indexAcceptable (lua_State *L, int index) { - if (index >= 0) { + if (index == 0) { + return NULL; + } else if (index > 0) { TObject *o = L->Cbase+(index-1); if (o >= L->top) return NULL; else return o; + } else { + TObject *o = L->top+index; + if(o < L->Cbase) return NULL; + else return o; } - else return L->top+index; } |