diff options
| author | Dennis Schridde <devurandom@gmx.net> | 2012-10-03 02:54:08 +0200 |
|---|---|---|
| committer | Dennis Schridde <devurandom@gmx.net> | 2012-10-03 02:54:08 +0200 |
| commit | 8e7217e74fbe5da0a9c1fee03d191b5a0266cedd (patch) | |
| tree | 5d40a50a0ce1ee9e88052407e81bf38808c3391f /src | |
| parent | 944e325e2930a19ed7783816def8cd94508a15f8 (diff) | |
| download | luafilesystem-8e7217e74fbe5da0a9c1fee03d191b5a0266cedd.tar.gz luafilesystem-8e7217e74fbe5da0a9c1fee03d191b5a0266cedd.tar.bz2 luafilesystem-8e7217e74fbe5da0a9c1fee03d191b5a0266cedd.zip | |
Full Lua 5.2 compatibility and adherance to modules-create-no-globals
Diffstat (limited to 'src')
| -rw-r--r-- | src/lfs.c | 20 |
1 files changed, 7 insertions, 13 deletions
| @@ -56,20 +56,14 @@ | |||
| 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" | ||
| 63 | #include "lfs.h" | ||
| 64 | 62 | ||
| 65 | /* | 63 | #include "lfs.h" |
| 66 | * ** compatibility with Lua 5.2 | ||
| 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 | 64 | ||
| 65 | #if LUA_VERSION_NUM < 502 | ||
| 66 | # define luaL_newlib(L,l) (lua_newtable(L), luaL_register(L,NULL,l)) | ||
| 73 | #endif | 67 | #endif |
| 74 | 68 | ||
| 75 | /* Define 'strerror' for systems that do not implement it */ | 69 | /* Define 'strerror' for systems that do not implement it */ |
| @@ -881,7 +875,7 @@ static const struct luaL_Reg fslib[] = { | |||
| 881 | int luaopen_lfs (lua_State *L) { | 875 | int luaopen_lfs (lua_State *L) { |
| 882 | dir_create_meta (L); | 876 | dir_create_meta (L); |
| 883 | lock_create_meta (L); | 877 | lock_create_meta (L); |
| 884 | luaL_register (L, "lfs", fslib); | 878 | luaL_newlib (L, fslib); |
| 885 | set_info (L); | 879 | set_info (L); |
| 886 | return 1; | 880 | return 1; |
| 887 | } | 881 | } |
