[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: check if file exists
- From: Björn De Meyer <bjorn.demeyer@...>
- Date: Sun, 24 Nov 2002 13:40:36 +0100
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.
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
"No one knows true heroes, for they speak not of their greatness." --
Björn De Meyer