Re: luafs fileinfo
Thatcher Ulrich <[email protected]> Fri, 5 Mar 2004 09:40:53 -0500
| Newsgroups | gmane.comp.lang.lua.luacheia |
|---|---|
| Message-ID | <[email protected]> |
On Mar 05, 2004 at 12:23 +0200, Serge Semashko wrote:
> Hello All,
>
> After runing a test script in luacheia (installed from
> luacheia5-win32-5.0.1a5.exe on Windows XP) I get the following output:
>
> dummy: No such file or directory
> dummy file not found
>
> How can I hide this "dummy: No such file or directory" message?
> The source of test script is here:
>
> cheia.loadmodule("fs")
> if fs.fileinfo("dummy") then
> print("dummy file found")
> else
> print("dummy file not found")
> end
A couple more notes:
* you should always use cheia.load("modulename") to load modules --
that will ensure the wrapper script gets executed, and also, some
modules won't load properly using cheia.loadmodule() since they use
a different binary linking convention. The module wrapper script
takes care of all that.
* for a temporary work-around, you could do something like (untested):
function file_exists(fn)
local handle = io.open(fn)
if handle then io.close(handle) return true end
return false
end
function my_fileinfo(fn)
if file_exists(fn) then return fs.fileinfo(fn) end
return nil
end
--
Thatcher Ulrich
http://tulrich.com
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click