enumerate files in a Directory - Not Possible?

This has been a pending issue with a lot of developers, how to enumerate files from a directory. There are some ways to actually get this working, but that would entail keeping track of every file created, manipulated or deleted. Though this was generally responded to with Cannot be done, I have found the official response about the inability of Lua to do so and the reason, so here is that official text.

The standard version of Lua does not itself contain a portable method to obtain a list of files or directories from your file system. The reason is that, for portability, Lua restricts itself to ANSI C, which itself does not provide this capability. These capabilities are, however, often available through the operating system (e.g. readdir on POSIX, _findfirst / _findnext on VC/Windows, or FindFirstFile/FindNextFile on plain Win32 (kernel32.dll)). These can be accessed through extension libraries or even os.execute calls to the shell.

Delving further, I have got this to work in the xcode simulator but it does not work on the device so it cannot be really called useful at this stage. However to see the progress, here it is running in xcode simulator.


Popular Posts