From e58eebd62c4076fcce0560e5360d43dd9c3d7d9e Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Thu, 4 Feb 2010 10:37:09 +0100 Subject: Apply patch from Wiki bug report #615. Thanks to Kernigh for the fix. --- src/lua/lapi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3