diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2015-07-08 21:18:20 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2015-07-08 21:18:20 +0100 |
commit | 72abd9a73b13e15e467ad96ec15d8217837b21e4 (patch) | |
tree | 7b58acfe0b713ab9053a323033ed2439f6d949bf | |
parent | 4e0ed16d7cce90d61118db52c06c507772177714 (diff) | |
download | lua-scrypt-git-72abd9a73b13e15e467ad96ec15d8217837b21e4.tar.gz |
Better support for Lua 5.2v1.0
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | luascrypt.c | 5 |
2 files changed, 11 insertions, 4 deletions
@@ -104,6 +104,8 @@ CFLAGS ?= -O2 -Wall INSTALL := /usr/bin/install SCRYPT_LIBS := -lscrypt +CFLAGS := $(CFLAGS) -fPIC + all: lua-5.1-try lua-5.2-try clean: @@ -121,8 +123,8 @@ lua-5.1-install: lua-5.1 $(INSTALL) -d $(DESTDIR)$(LUA51_CMOD_INST) $(INSTALL) -m 755 scrypt-5.1.so $(DESTDIR)$(LUA51_CMOD_INST)/scrypt.so -scrypt-5.1.so: luascrypt.o - $(CC) $(CFLAGS) -shared -o $@ $^ $(LUA51_LIB) $(SCRYPT_LIBS) +scrypt-5.1.so: luascrypt.c + $(CC) $(CFLAGS) $(LUA51_INC) -shared -o $@ $^ $(LUA51_LIB) $(SCRYPT_LIBS) lua-5.2: scrypt-5.2.so ln -s -f scrypt-5.2.so scrypt.so @@ -131,8 +133,8 @@ lua-5.2-install: lua-5.2 $(INSTALL) -d $(DESTDIR)$(LUA52_CMOD_INST) $(INSTALL) -m 755 scrypt-5.2.so $(DESTDIR)$(LUA52_CMOD_INST)/scrypt.so -scrypt-5.2.so: luascrypt.o - $(CC) $(CFLAGS) -shared -o $@ $^ $(LUA51_LIB) $(SCRYPT_LIBS) +scrypt-5.2.so: luascrypt.c + $(CC) $(CFLAGS) $(LUA52_INC) -shared -o $@ $^ $(LUA52_LIB) $(SCRYPT_LIBS) doc: diff --git a/luascrypt.c b/luascrypt.c index e824cea..f9dce0a 100644 --- a/luascrypt.c +++ b/luascrypt.c @@ -146,6 +146,11 @@ luascrypt_functions[] = { int luaopen_scrypt(lua_State *L) { +#if LUA_VERSION_NUM > 501 + lua_newtable(L); + luaL_setfuncs(L, luascrypt_functions, 0); +#else luaL_register(L, "scrypt", luascrypt_functions); +#endif return 1; } |