lua-users home
lua-l archive

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


Markus Huber wrote:
> 
> Any ideas how to check the existence of a file?
> Or better read the object type e.g.:
> 
>    0 doesn't exist
>    1 is a file
>    2 is a directory
>    3 is a link (I don't know the exact name of this type)
> 
> Independent of the file access attributes!
> 
> I feel that very few further functions are needed to make Lua a great
> language for file manipulation. Like read/set access rights and read
> directory entries.
> 
> --
> Markus

Try opening the file with read only access. 
If that fails the file does not exist.
The other functionality you would like is
beyond the scope of ANSI C, and therefore
you will have to extend Lua yourself with 
these functions. 

-- 
"No one knows true heroes, for they speak not of their greatness." -- 
Daniel Remar.
Björn De Meyer 
bjorn.demeyer@pandora.be