diff options
| author | Fabio Mascarenhas <mascarenhas@gmail.com> | 2012-10-04 07:00:22 -0700 |
|---|---|---|
| committer | Fabio Mascarenhas <mascarenhas@gmail.com> | 2012-10-04 07:00:22 -0700 |
| commit | 62d5dbe3b6375e19573ad8f8af23df318bb05042 (patch) | |
| tree | 899cba2237f04413e54165b0f513ed6ba0735a6b | |
| parent | 944e325e2930a19ed7783816def8cd94508a15f8 (diff) | |
| parent | f42c1a1a38cb6ee448bbb36fb5c8fadeebef84fc (diff) | |
| download | luafilesystem-62d5dbe3b6375e19573ad8f8af23df318bb05042.tar.gz luafilesystem-62d5dbe3b6375e19573ad8f8af23df318bb05042.tar.bz2 luafilesystem-62d5dbe3b6375e19573ad8f8af23df318bb05042.zip | |
Merge pull request #18 from devurandom/fix/lua52
Full Lua 5.2 compatibility and adherance to modules-create-no-globals
| -rw-r--r-- | README | 3 | ||||
| -rw-r--r-- | doc/us/examples.html | 2 | ||||
| -rw-r--r-- | doc/us/index.html | 7 | ||||
| -rw-r--r-- | rockspecs/luafilesystem-1.6.2-1.rockspec | 27 | ||||
| -rw-r--r-- | src/lfs.c | 25 |
5 files changed, 49 insertions, 15 deletions
| @@ -22,6 +22,9 @@ Please check the documentation at doc/us/ for more information. | |||
| 22 | History | 22 | History |
| 23 | ------- | 23 | ------- |
| 24 | 24 | ||
| 25 | Version 1.6.2 [??/Oct/2012] | ||
| 26 | * Full Lua 5.2 compatibility (with Lua 5.1 fallbacks) | ||
| 27 | |||
| 25 | Version 1.6.1 [01/Oct/2012] | 28 | Version 1.6.1 [01/Oct/2012] |
| 26 | * fix build for Lua 5.2 | 29 | * fix build for Lua 5.2 |
| 27 | 30 | ||
diff --git a/doc/us/examples.html b/doc/us/examples.html index 65a6623..d6d32fc 100644 --- a/doc/us/examples.html +++ b/doc/us/examples.html | |||
| @@ -65,7 +65,7 @@ | |||
| 65 | attributes for each file inside it.</p> | 65 | attributes for each file inside it.</p> |
| 66 | 66 | ||
| 67 | <pre class="example"> | 67 | <pre class="example"> |
| 68 | require"lfs" | 68 | local lfs = require"lfs" |
| 69 | 69 | ||
| 70 | function attrdir (path) | 70 | function attrdir (path) |
| 71 | for file in lfs.dir(path) do | 71 | for file in lfs.dir(path) do |
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.</p> | |||
| 71 | 71 | ||
| 72 | <h2><a name="status"></a>Status</h2> | 72 | <h2><a name="status"></a>Status</h2> |
| 73 | 73 | ||
| 74 | <p>Current version is 1.6.0. It was developed for Lua 5.1 but also | 74 | <p>Current version is 1.6.2. It was developed for Lua 5.1 but also |
| 75 | works with Lua 5.2.</p> | 75 | works with Lua 5.2.</p> |
| 76 | 76 | ||
| 77 | <h2><a name="download"></a>Download</h2> | 77 | <h2><a name="download"></a>Download</h2> |
| @@ -83,6 +83,11 @@ page.</p> | |||
| 83 | <h2><a name="history"></a>History</h2> | 83 | <h2><a name="history"></a>History</h2> |
| 84 | 84 | ||
| 85 | <dl class="history"> | 85 | <dl class="history"> |
| 86 | <dt><strong>Version 1.6.2</strong> [??/Oct/2012]</dt> | ||
| 87 | <dd><ul> | ||
| 88 | <li>Full Lua 5.2 compatibility (with Lua 5.1 fallbacks)</li> | ||
| 89 | </ul></dd> | ||
| 90 | |||
| 86 | <dt><strong>Version 1.6.1</strong> [01/Oct/2012]</dt> | 91 | <dt><strong>Version 1.6.1</strong> [01/Oct/2012]</dt> |
| 87 | <dd><ul> | 92 | <dd><ul> |
| 88 | <li>fix build for Lua 5.2</li> | 93 | <li>fix build for Lua 5.2</li> |
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 @@ | |||
| 1 | package = "LuaFileSystem" | ||
| 2 | |||
| 3 | version = "1.6.2-1" | ||
| 4 | |||
| 5 | source = { | ||
| 6 | url = "https://github.com/downloads/keplerproject/luafilesystem/luafilesystem-1.6.2.tar.gz", | ||
| 7 | } | ||
| 8 | |||
| 9 | description = { | ||
| 10 | summary = "File System Library for the Lua Programming Language", | ||
| 11 | detailed = [[ | ||
| 12 | LuaFileSystem is a Lua library developed to complement the set of | ||
| 13 | functions related to file systems offered by the standard Lua | ||
| 14 | distribution. LuaFileSystem offers a portable way to access the | ||
| 15 | underlying directory structure and file attributes. | ||
| 16 | ]] | ||
| 17 | } | ||
| 18 | |||
| 19 | dependencies = { | ||
| 20 | "lua >= 5.1" | ||
| 21 | } | ||
| 22 | |||
| 23 | build = { | ||
| 24 | type = "builtin", | ||
| 25 | modules = { lfs = "src/lfs.c" }, | ||
| 26 | copy_directories = { "doc", "tests" } | ||
| 27 | } | ||
| @@ -56,20 +56,17 @@ | |||
| 56 | #include <utime.h> | 56 | #include <utime.h> |
| 57 | #endif | 57 | #endif |
| 58 | 58 | ||
| 59 | #define LUA_COMPAT_ALL | 59 | #include <lua.h> |
| 60 | #include "lua.h" | 60 | #include <lauxlib.h> |
| 61 | #include "lauxlib.h" | 61 | #include <lualib.h> |
| 62 | #include "lualib.h" | 62 | |
| 63 | #include "lfs.h" | 63 | #include "lfs.h" |
| 64 | 64 | ||
| 65 | /* | 65 | #define LFS_VERSION "1.6.2" |
| 66 | * ** compatibility with Lua 5.2 | 66 | #define LFS_LIBNAME "lfs" |
| 67 | * */ | ||
| 68 | #if (LUA_VERSION_NUM == 502) | ||
| 69 | #undef luaL_register | ||
| 70 | #define luaL_register(L,n,f) \ | ||
| 71 | { if ((n) == NULL) luaL_setfuncs(L,f,0); else luaL_newlib(L,f); } | ||
| 72 | 67 | ||
| 68 | #if LUA_VERSION_NUM < 502 | ||
| 69 | # define luaL_newlib(L,l) (lua_newtable(L), luaL_register(L,NULL,l)) | ||
| 73 | #endif | 70 | #endif |
| 74 | 71 | ||
| 75 | /* Define 'strerror' for systems that do not implement it */ | 72 | /* Define 'strerror' for systems that do not implement it */ |
| @@ -856,7 +853,7 @@ static void set_info (lua_State *L) { | |||
| 856 | 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"); | 853 | 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"); |
| 857 | lua_settable (L, -3); | 854 | lua_settable (L, -3); |
| 858 | lua_pushliteral (L, "_VERSION"); | 855 | lua_pushliteral (L, "_VERSION"); |
| 859 | lua_pushliteral (L, "LuaFileSystem 1.6.0"); | 856 | lua_pushliteral (L, "LuaFileSystem "LFS_VERSION); |
| 860 | lua_settable (L, -3); | 857 | lua_settable (L, -3); |
| 861 | } | 858 | } |
| 862 | 859 | ||
| @@ -881,7 +878,9 @@ static const struct luaL_Reg fslib[] = { | |||
| 881 | int luaopen_lfs (lua_State *L) { | 878 | int luaopen_lfs (lua_State *L) { |
| 882 | dir_create_meta (L); | 879 | dir_create_meta (L); |
| 883 | lock_create_meta (L); | 880 | lock_create_meta (L); |
| 884 | luaL_register (L, "lfs", fslib); | 881 | luaL_newlib (L, fslib); |
| 882 | lua_pushvalue(L, -1); | ||
| 883 | lua_setglobal(L, LFS_LIBNAME); | ||
| 885 | set_info (L); | 884 | set_info (L); |
| 886 | return 1; | 885 | return 1; |
| 887 | } | 886 | } |
