|
And I have no idea where to find this compat-5.1.h.
A good starting point (though admittedly not a 100% complete one) for looking around for handy add-on libraries is here:
http://lua-users.org/wiki/LibrariesAndBindings where you'll see these, amongst many others:* [LuaFileSystem] (5.1) - a library developed to complement the set of functions related to file systems.
* [Compat-5.1] (5.0) - simulates the Lua 5.1 package model under Lua 5.0 so you can use 5.1 packages.
LFS is great because it's really small, and gives you a lot of the file system stuff you need, whilst allowing the Lua core to stay "ANSI pure".
The only things it doesn't give you which I wish it did are a way of calling lstat() (or equivalent on Windows) so you can see whether a file is real or a symlink, and a bidirectional subcommand-via-pipe function of the popen2() flavour (other implementations of this exist).