[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua, testing whether a file exists...
- From: Michael Roth <mroth@...>
- Date: Wed, 01 Sep 2004 16:18:04 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
The Doctor wrote:
| Please can someone tell me if Lua can tell if a file exists?
function exists(filename)
local file = io.open(filename)
if file then
io.close(file)
return true
else
return false
end
end
| I've tried testing for for a valid return from io.open(),
| but if the file doesn't exist, Lua throws up a default error,
| never mind trying to run my own handling code...
???
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFBNdobSIrOxc3jOmoRAi3SAJ4h9UmBF1LCyre7ebbu4JUmfzF47wCfbnzl
rsqh5uCwPVchZb6FyVn1Mmo=
=Pa9/
-----END PGP SIGNATURE-----