lua-users home
lua-l archive

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


On 2014-01-21 10:20, Luiz Henrique de Figueiredo wrote:
Lua 5.2.3 Copyright (C) 1994-2013 Lua.org, PUC-Rio
loadfile()()
print("Hello,")
^Z
Hello,
loadfile()()
print(" world!")

In Mac OS X (10.7.5), the second loadfile does nothing, which is as
expected, since stdin has already reached EOF by the ^D after the first
loadfile.

Is it possible to input ,,loadfile()''? It should not be possible as stdin has reached EOF.

I've seen programs in Linux being able to read from stdin just
fine after it had reached EOF, but it is not be expected, is it?

It would be nice if it was consistent. Now, the behaviour is inconsistent. (1) From your description of iOS: (a) I can input ,,loadfile()()'' by ,,readline()'' (or ,,fgets()'', or sth, ...), but (b) I cannot input ,,print(" world!") because ,,stdin'' has reached EOF. OK - ,,lua'' is a referencing example, but in case of Win/Linux (2): (b) from every input I can read the 1st char only.

What if an other process/device/whatever will append data to a file which has reached EOF? Should not it be possible to read such a file? Should the file retain end-of-file status? I would be able to read a file expanded by something else without reopening it.

--
-- best regards

Cezary H. Noweta