diff options
author | Dennis Schridde <devurandom@gmx.net> | 2012-10-04 10:48:07 +0200 |
---|---|---|
committer | Dennis Schridde <devurandom@gmx.net> | 2012-10-04 10:48:07 +0200 |
commit | f42c1a1a38cb6ee448bbb36fb5c8fadeebef84fc (patch) | |
tree | 899cba2237f04413e54165b0f513ed6ba0735a6b /src | |
parent | 5e55437028cc03d79c5a3cddce0cf8aecd0de2be (diff) | |
download | luafilesystem-f42c1a1a38cb6ee448bbb36fb5c8fadeebef84fc.tar.gz luafilesystem-f42c1a1a38cb6ee448bbb36fb5c8fadeebef84fc.tar.bz2 luafilesystem-f42c1a1a38cb6ee448bbb36fb5c8fadeebef84fc.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/lfs.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -63,6 +63,7 @@ | |||
63 | #include "lfs.h" | 63 | #include "lfs.h" |
64 | 64 | ||
65 | #define LFS_VERSION "1.6.2" | 65 | #define LFS_VERSION "1.6.2" |
66 | #define LFS_LIBNAME "lfs" | ||
66 | 67 | ||
67 | #if LUA_VERSION_NUM < 502 | 68 | #if LUA_VERSION_NUM < 502 |
68 | # define luaL_newlib(L,l) (lua_newtable(L), luaL_register(L,NULL,l)) | 69 | # define luaL_newlib(L,l) (lua_newtable(L), luaL_register(L,NULL,l)) |
@@ -878,6 +879,8 @@ int luaopen_lfs (lua_State *L) { | |||
878 | dir_create_meta (L); | 879 | dir_create_meta (L); |
879 | lock_create_meta (L); | 880 | lock_create_meta (L); |
880 | luaL_newlib (L, fslib); | 881 | luaL_newlib (L, fslib); |
882 | lua_pushvalue(L, -1); | ||
883 | lua_setglobal(L, LFS_LIBNAME); | ||
881 | set_info (L); | 884 | set_info (L); |
882 | return 1; | 885 | return 1; |
883 | } | 886 | } |