aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lfs.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lfs.c b/src/lfs.c
index 17700fa..99a35bb 100644
--- a/src/lfs.c
+++ b/src/lfs.c
@@ -725,7 +725,13 @@ static int dir_iter_factory(lua_State * L)
725 if (d->dir == NULL) 725 if (d->dir == NULL)
726 luaL_error(L, "cannot open %s: %s", path, strerror(errno)); 726 luaL_error(L, "cannot open %s: %s", path, strerror(errno));
727#endif 727#endif
728#if LUA_VERSION_NUM >= 504
729 lua_pushnil(L);
730 lua_pushvalue(L, -2);
731 return 4;
732#else
728 return 2; 733 return 2;
734#endif
729} 735}
730 736
731 737
@@ -747,6 +753,11 @@ static int dir_create_meta(lua_State * L)
747 lua_setfield(L, -2, "__index"); 753 lua_setfield(L, -2, "__index");
748 lua_pushcfunction(L, dir_close); 754 lua_pushcfunction(L, dir_close);
749 lua_setfield(L, -2, "__gc"); 755 lua_setfield(L, -2, "__gc");
756
757#if LUA_VERSION_NUM >= 504
758 lua_pushcfunction(L, dir_close);
759 lua_setfield(L, -2, "__close");
760#endif
750 return 1; 761 return 1;
751} 762}
752 763