From 8e7217e74fbe5da0a9c1fee03d191b5a0266cedd Mon Sep 17 00:00:00 2001 From: Dennis Schridde Date: Wed, 3 Oct 2012 02:54:08 +0200 Subject: Full Lua 5.2 compatibility and adherance to modules-create-no-globals --- src/lfs.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/lfs.c b/src/lfs.c index 8234711..8aa7412 100644 --- a/src/lfs.c +++ b/src/lfs.c @@ -56,20 +56,14 @@ #include #endif -#define LUA_COMPAT_ALL -#include "lua.h" -#include "lauxlib.h" -#include "lualib.h" -#include "lfs.h" +#include +#include +#include -/* - * ** compatibility with Lua 5.2 - * */ -#if (LUA_VERSION_NUM == 502) -#undef luaL_register -#define luaL_register(L,n,f) \ - { if ((n) == NULL) luaL_setfuncs(L,f,0); else luaL_newlib(L,f); } +#include "lfs.h" +#if LUA_VERSION_NUM < 502 +# define luaL_newlib(L,l) (lua_newtable(L), luaL_register(L,NULL,l)) #endif /* Define 'strerror' for systems that do not implement it */ @@ -881,7 +875,7 @@ static const struct luaL_Reg fslib[] = { int luaopen_lfs (lua_State *L) { dir_create_meta (L); lock_create_meta (L); - luaL_register (L, "lfs", fslib); + luaL_newlib (L, fslib); set_info (L); return 1; } -- cgit v1.2.3-55-g6feb From 5e55437028cc03d79c5a3cddce0cf8aecd0de2be Mon Sep 17 00:00:00 2001 From: Dennis Schridde Date: Wed, 3 Oct 2012 02:58:57 +0200 Subject: Bump version to 1.6.2 and set version via define in src/lfs.c to make it better visible --- README | 3 +++ doc/us/index.html | 7 ++++++- rockspecs/luafilesystem-1.6.2-1.rockspec | 27 +++++++++++++++++++++++++++ src/lfs.c | 4 +++- 4 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 rockspecs/luafilesystem-1.6.2-1.rockspec (limited to 'src') diff --git a/README b/README index c1fe6c7..db67923 100644 --- a/README +++ b/README @@ -22,6 +22,9 @@ Please check the documentation at doc/us/ for more information. History ------- +Version 1.6.2 [??/Oct/2012] + * Full Lua 5.2 compatibility (with Lua 5.1 fallbacks) + Version 1.6.1 [01/Oct/2012] * fix build for Lua 5.2 diff --git a/doc/us/index.html b/doc/us/index.html index 1046bd9..8873222 100644 --- a/doc/us/index.html +++ b/doc/us/index.html @@ -71,7 +71,7 @@ the underlying directory structure and file attributes.

Status

-

Current version is 1.6.0. It was developed for Lua 5.1 but also +

Current version is 1.6.2. It was developed for Lua 5.1 but also works with Lua 5.2.

Download

@@ -83,6 +83,11 @@ page.

History

+
Version 1.6.2 [??/Oct/2012]
+
    +
  • Full Lua 5.2 compatibility (with Lua 5.1 fallbacks)
  • +
+
Version 1.6.1 [01/Oct/2012]
  • fix build for Lua 5.2
  • diff --git a/rockspecs/luafilesystem-1.6.2-1.rockspec b/rockspecs/luafilesystem-1.6.2-1.rockspec new file mode 100644 index 0000000..1c11efc --- /dev/null +++ b/rockspecs/luafilesystem-1.6.2-1.rockspec @@ -0,0 +1,27 @@ +package = "LuaFileSystem" + +version = "1.6.2-1" + +source = { + url = "https://github.com/downloads/keplerproject/luafilesystem/luafilesystem-1.6.2.tar.gz", +} + +description = { + summary = "File System Library for the Lua Programming Language", + detailed = [[ + LuaFileSystem is a Lua library developed to complement the set of + functions related to file systems offered by the standard Lua + distribution. LuaFileSystem offers a portable way to access the + underlying directory structure and file attributes. + ]] +} + +dependencies = { + "lua >= 5.1" +} + +build = { + type = "builtin", + modules = { lfs = "src/lfs.c" }, + copy_directories = { "doc", "tests" } +} diff --git a/src/lfs.c b/src/lfs.c index 8aa7412..5a6ca7c 100644 --- a/src/lfs.c +++ b/src/lfs.c @@ -62,6 +62,8 @@ #include "lfs.h" +#define LFS_VERSION "1.6.2" + #if LUA_VERSION_NUM < 502 # define luaL_newlib(L,l) (lua_newtable(L), luaL_register(L,NULL,l)) #endif @@ -850,7 +852,7 @@ static void set_info (lua_State *L) { lua_pushliteral (L, "LuaFileSystem is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution"); lua_settable (L, -3); lua_pushliteral (L, "_VERSION"); - lua_pushliteral (L, "LuaFileSystem 1.6.0"); + lua_pushliteral (L, "LuaFileSystem "LFS_VERSION); lua_settable (L, -3); } -- cgit v1.2.3-55-g6feb From f42c1a1a38cb6ee448bbb36fb5c8fadeebef84fc Mon Sep 17 00:00:00 2001 From: Dennis Schridde Date: Thu, 4 Oct 2012 10:48:07 +0200 Subject: Set global "lfs" when opening module * Ensures backward compatibility with LFS 1.5 * Module name is defined as LFS_LIBNAME, similar to how Lua standard libraries are defined --- src/lfs.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/lfs.c b/src/lfs.c index 5a6ca7c..6259b6a 100644 --- a/src/lfs.c +++ b/src/lfs.c @@ -63,6 +63,7 @@ #include "lfs.h" #define LFS_VERSION "1.6.2" +#define LFS_LIBNAME "lfs" #if LUA_VERSION_NUM < 502 # define luaL_newlib(L,l) (lua_newtable(L), luaL_register(L,NULL,l)) @@ -878,6 +879,8 @@ int luaopen_lfs (lua_State *L) { dir_create_meta (L); lock_create_meta (L); luaL_newlib (L, fslib); + lua_pushvalue(L, -1); + lua_setglobal(L, LFS_LIBNAME); set_info (L); return 1; } -- cgit v1.2.3-55-g6feb