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