lua-users home
lua-l archive

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


	Hi Peter

> Tomas Guisasola Gorham wrote:
> > 	I think Peter has summarized the options we have:
> > 
> >>   * have lfs.attributes() accept an optional argument not to follow links, which 
> >> is backwards compatible, assuming no redundant arguments are passed;
> >>   * add a function which doesn't follow links;
> >>   * perform stat() aswell as lstat() in lfs.attributes(), which means both modes 
> >> can be returned.
> > 	I am not sure what should be done in the last option.  Suppose
> > `lfs.attributes' performs both `stat' and `lstat'.  What will be the
> > result of `mode'?
> 
> Sorry for the confusion :). I meant for the last option to be compatible with 
> duck's original request, i.e. return a table of mode strings (which could 
> indicate `file', `directory', `link to file', `link to directory', `link to 
> nothing', etc.). I wouldn't personally go this way because I think the user 
> should follow links unless he/she explicitly requests not to (lstat/lattributes).
	Ok.  Then I think we could reduce the options to two :-)
At the moment I'll stay with Sam's implementation, just changing
the name of the new function to `linkattributes':

lfs.linkattributes("link", "mode") --> "link"
lfs.attributes("link", "mode") --> "file"

	What do you think?
		Tomás