lua-users home
lua-l archive

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


Peter Hill wrote:
> 
> So if I have two file handles, "filehandle1" and "filehandle2", is it true
> that "filehandle1.read == filehandle2.read"? The manual doesn't specify.

Yes, that's right. All filehandle.read refer to the 
same function on creation.  Look at the sources of the lualib,
you'l see for yourself. 

> If it is (and there is actually only ONE file reading function) then why
> isn't this single function available as a part of "io"? Why should I have to
> open a file before I can find it? =:-O

You needn't open a file. As said before, stdin is available as 
a default location for the same function. 


> NOTE:
> I don't object to having "filehandle.read" available for those who desire
> it... I just want "io.fread" -- or "io.read([<filehandle>,] format etc)" --
> also available for those who don't!

We already showed you a way how you can have it. Lua 5 is in feature 
freeze now, anyway, so even if the authors of Lua 
accept your proposal for future versions of Lua, it won't be for 
anytime soon. with only one line of code in your C host, you 
can have what you want.


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