missing functions (luafilesystem) ?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

missing functions (luafilesystem) ?

Mildred Ki'Lya
Hi,

I'm actually using luafilesystem but I think it would be great to have
others functions :
- a recursive flag for mkdir
- a copy function (which would be able to copy folders)
- maybe some functions to know if a file exists
- basename and dirname
- chmod, chown
- a way to create named pipes on unix systems (mkfifo)

Why these functions are missing ?
If youre interested, I can try to make a patch.

Also there are others functions that i want to see in the main library
(since I have to include them on almose evry project I have in lua) :
- try(function, functionHandler) : do a ppcall on function and call
functionHandler on error
- class(parentClass, table) : metatable(table).__index=parentClass
- addmetatable(object, key, value) : instead of :
        local mt = getmetatable(object)
        mt[key]=value
        setmetatable(object, mt)

Mildred

--
Mildred       <xmpp:[hidden email]> <http://mildred632.free.fr/>
Clef GPG :    <hkp://pgp.mit.edu> ou <http://mildred632.free.fr/gpg_key>
Fingerprint : 197C A7E6 645B 4299 6D37 684B 6F9D A8D6 [9A7D 2E2B]
Reply | Threaded
Open this post in threaded view
|

Re: missing functions (luafilesystem) ?

Javier Guerra Giraldez
On Tuesday 28 March 2006 1:35 pm, Mildred wrote:

> Hi,
>
> I'm actually using luafilesystem but I think it would be great to have
> others functions :
> - a recursive flag for mkdir
> - a copy function (which would be able to copy folders)
> - maybe some functions to know if a file exists
> - basename and dirname
> - chmod, chown
> - a way to create named pipes on unix systems (mkfifo)
>
> Why these functions are missing ?
most of those are obvious from the *nix point of view, but i think
luafilesystem aims to be platform agnostic.  Luiz has a different module:
luaPosix, that exports most of the usual *nix C API.

> - addmetatable(object, key, value) : instead of :
> local mt = getmetatable(object)
> mt[key]=value
> setmetatable(object, mt)

i guess that last line can be left out, making the whole routine just:

getmetatable(object)[key]=value

not much longer than "addmetatable(object, key, value)"

--
Javier

attachment0 (207 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: missing functions (luafilesystem) ?

Mildred Ki'Lya

On Tue, 28 Mar 2006 13:49:54 -0500 Javier Guerra <[hidden email]>
wrote:

> > I'm actually using luafilesystem but I think it would be great to
> > have others functions :
> > - a recursive flag for mkdir
> > - a copy function (which would be able to copy folders)
> > - maybe some functions to know if a file exists
> > - basename and dirname
> > - chmod, chown
> > - a way to create named pipes on unix systems (mkfifo)
>
> most of those are obvious from the *nix point of view, but i think=20
> luafilesystem aims to be platform agnostic.  Luiz has a different
> module:=20 luaPosix, that exports most of the usual *nix C API.

I agree that chmod, chown and mkfifo are unix only ... but not the
others (recursive mkdir, copy, file_exisis, basename, dirname)

But even for chmod and chown ... these functions can exist in
luafilesystem without problems. There is already unix attributes to the
attribute() function.
On others systems, these functions would have no effect ... and it
would be easier on unix systems.

> i guess that last line can be left out, making the whole routine just:
> getmetatable(object)[key]=3Dvalue

Thanks for that. I never realized it was possible.

--
Mildred       <xmpp:[hidden email]> <http://mildred632.free.fr/>
Clef GPG :    <hkp://pgp.mit.edu> ou <http://mildred632.free.fr/gpg_key>
Fingerprint : 197C A7E6 645B 4299 6D37 684B 6F9D A8D6 [9A7D 2E2B]
Reply | Threaded
Open this post in threaded view
|

Re: missing functions (luafilesystem) ?

Robert Hibberdine
In reply to this post by Mildred Ki'Lya
There's a posix library at
    http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/
that includes some of these.

I thought luafilesystem was designed for the kepler project and so
didn't have all feature on purpose?

Bob

Mildred wrote:

>Hi,
>
>I'm actually using luafilesystem but I think it would be great to have
>others functions :
>- a recursive flag for mkdir
>- a copy function (which would be able to copy folders)
>- maybe some functions to know if a file exists
>- basename and dirname
>- chmod, chown
>- a way to create named pipes on unix systems (mkfifo)
>
>Why these functions are missing ?
>If youre interested, I can try to make a patch.
>
>Also there are others functions that i want to see in the main library
>(since I have to include them on almose evry project I have in lua) :
>- try(function, functionHandler) : do a ppcall on function and call
>functionHandler on error
>- class(parentClass, table) : metatable(table).__index=parentClass
>- addmetatable(object, key, value) : instead of :
> local mt = getmetatable(object)
> mt[key]=value
> setmetatable(object, mt)
>
>Mildred
>
>  
>