summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2010-02-04 10:37:09 +0100
committerBardur Arantsson <bardur@scientician.net>2010-02-04 10:44:17 +0100
commite58eebd62c4076fcce0560e5360d43dd9c3d7d9e (patch)
tree09adee0343dd89400e973e1043acf6bac7dea70a
parent655308482200fb624b51246b50aa6866750e9c78 (diff)
Apply patch from Wiki bug report #615.
Thanks to Kernigh for the fix.
-rw-r--r--changes.txt2
-rw-r--r--src/lua/lapi.c9
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;
}