lua-users home
lua-l archive

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


Luiz Henrique de Figueiredo:
> I guess the stdin stuff mislead you: stdin is just a handy filehandle
> that's always available. But once you have any filehandle, you can
> do io.fread = filehandle.read and get your function as above. That
> filehandle.read is the function you want should be clear from the
> definition of ":" as syntax sugar.

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

If not then I can't create a general 'fread' from "io.fread =
filehandle1.read". :-(

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


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!

Cheers,
Peter Hill.