lua-users home
lua-l archive

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

2017-09-18 2:35 GMT+02:00 Javier Guerra Giraldez <>:
> On 16 September 2017 at 17:58, Russell Haley <> wrote:
>> Could someone please *name* a filesystem that they use Lua on that is *not* windows or posix compliant?
> easy, embedded systems, like NodeMCU.  Terrible name, but it's a
> really popular platform, introducing Lua to a new group of people.
> while there's something like a filesystem, it's _very_ far from POSIX!

Well, LuaFileSystem is much less than POSIX. As long as the filesystem
has filenames, we are in business. The most pressing need is directories.
Links and locks can wait.

On filesystems that don't have directories, the concept can be replaced
by a name prefix.

Something like this:

The current prefix is kept in the registry. New functions in the IO library
do what lfs currently does on systems that can, otherwise:

io.currentdir Return the prefix.
io.chdir  Modify the prefix.
io.dir      Iterate over the tails of filenames that start with that prefix.
io.touch, io.mkdir, io.rmdir  Just do as much as possible.

Existing functions that need to be aware of the prefix:, io.popen  Concatenate prefix with appropriate separator to
  to the supplied tail.

Would that much be possible in NodeMCU?