lua-users home
lua-l archive

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


Hello Sean,

On Wed, Jan 22, 2020 at 06:46:32PM -0500, Sean Conner wrote:
> ...
> Usage:        list[,errs,erri] = list([name])
> Desc:         Return a list of entries in a directory.  If no directory
>               is given, return the entries in the current directory.
> Input:        name (string/optional) name of directory, defaults to current diretory
> Return:       list (array of string) list of filename in directory, nil on error.
>               errs (string/optional) error message on failure
>               erri (integer/optional) error number on failure
> 
> Note:         The order of filenames is unspecified.
> 
>               The current and parent entries (if defined for a system)
>               will NOT appear in the list.
> 
> 	---
> 
> Usage:        for entry in glist([name]) do ... end
> Desc:         Return an iterator for traversing a directory; if not given,
>               traverse the current directory.
> Input:        name (string/optional) name of directory, defaults to current directory
> Return:       (iterator function)
>               (iterator state)
>               (iterator var) (string) filename

What happens when glist(name) is called with a name that would cause
list(name) to fail?

> ...
> Usage:        list[,errs,erri] = expand(pattern)
> Desc:         Expand a list of filenames from a file globbing pattern
> Input:        pattern (string) an operating system dependent globbing pattern
> Return:       list (array) list of filename matching pattern, nil on error
>               errs (string/optional) error message on failure
>               erri (integer/optional) error number on failure
> 
> Note:         The ordering of filenames is unspecified.
> 
> 	---
> 
> Usage:        for entry in gexpand(pattern) do ... end
> Desc:         Return an iterator for traversing a file glob
> Input:        pattern (string) an operating system dependent globbing pattern
> Return:       (iterator function)
>               (iterator state)
>               (iterator var) (string) filename

And similarly, what happens when gexpand(pattern) is called with a
pattern that would cause expand(pattern) to fail?

> ...

Regards
Thorkil