From 526c5e73738a19b7c0e50391ba1325786367a466 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 9 Feb 2018 18:29:21 -0800 Subject: [PATCH] Fixed Lua 5.1 compatibility with lua_len() and cleaned up makefile so it doesn't test by default. --- Makefile | 6 +++--- limmutable.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 0eb1bc7..85d485c 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ LUAINC= $(LUA)/src LUALIB= $(LUA)/src LUABIN= $(LUA)/src -LUASUFFIX= "" +LUASUFFIX= # these will probably work if Lua has been installed globally #LUA= /usr/local @@ -26,9 +26,9 @@ T= $(MYNAME).so OBJS= $(MYLIB).o TEST= test.lua -all: test +all: $T -test: $T +test: $T $(LUABIN)/lua$(LUASUFFIX) $(TEST) o: $(MYLIB).o diff --git a/limmutable.c b/limmutable.c index 493f1ff..a9aab78 100644 --- a/limmutable.c +++ b/limmutable.c @@ -207,7 +207,7 @@ static int Llen(lua_State *L) // Stack: [mt] lua_getfield(L, -1, "__fields"); // Stack: [mt, fields] - lua_len(L, -1); + lua_pushinteger(L, lua_objlen(L, -1)); return 1; }