diff options
-rw-r--r-- | changes.txt | 2 | ||||
-rw-r--r-- | src/lua/lapi.c | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/changes.txt b/changes.txt index 97a5b78f..cb3288cf 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,7 @@ T.o.M.E 2.3.8 (ah) +- Fix for Lua code which should hopefully get things working better + for OpenBSD users. Thanks to Kernigh for the patch. - Change "molten glass wall" to use a different internal code to hopefully avoid clashes with modules such as Theme. - Removed the check on low fuel on your light source when traveling. 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; } |