lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

>There is no directory listing feature in ANSI C as far as I know. You
>could popen a call to ls, but that's about all I can suggest.

In the good old days you could open "." and read its contents, but this now
gives an error (at least in Linux). :-(

% cat .
cat: .: Is a directory

>It'd be more useful to write a library which loadlib can call, to add
>these features in. Perhaps similar to the POSIX library which used to
>exist for Lua 4.0

There *is* a posix library for Lua 5.0 at

But perhaps it is easy to write a small portable library for directory
processing. It can't be hard to write a readdir emulation for other platforms.
It's probably already available somewhere in the web and so it'll be simply a
matter of wrapping it for Lua (using the relevant POSIX binding).

If someone knows of a multiplatform readdir emulation, please let me know.