aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Good <ian.good@rackspace.com>2012-02-28 03:37:14 +0000
committerIan Good <ian.good@rackspace.com>2012-02-28 03:37:14 +0000
commitf634765b26c52d03aceed88c2130130ab43f6fa9 (patch)
tree778105d157564cf516f3b382912af2ef88b62825
parent149e0fb8ec6295325e1e448bbe79b7e9bf2285aa (diff)
downloadluafilesystem-f634765b26c52d03aceed88c2130130ab43f6fa9.tar.gz
luafilesystem-f634765b26c52d03aceed88c2130130ab43f6fa9.tar.bz2
luafilesystem-f634765b26c52d03aceed88c2130130ab43f6fa9.zip
implements fake luaL_register in Lua 5.2+
-rw-r--r--src/lfs.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lfs.c b/src/lfs.c
index e95dcab..8b8f68e 100644
--- a/src/lfs.c
+++ b/src/lfs.c
@@ -819,6 +819,15 @@ static const struct luaL_Reg fslib[] = {
819 {NULL, NULL}, 819 {NULL, NULL},
820}; 820};
821 821
822#if LUA_VERSION_NUM > 501
823static void luaL_register (lua_State *L, const char *libname, const luaL_Reg *l)
824{
825 luaL_newlib (L, l);
826 lua_pushvalue (L, -1);
827 lua_setglobal (L, libname);
828}
829#endif
830
822int luaopen_lfs (lua_State *L) { 831int luaopen_lfs (lua_State *L) {
823 dir_create_meta (L); 832 dir_create_meta (L);
824 lock_create_meta (L); 833 lock_create_meta (L);