lua-users home
lua-l archive

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

On Fri, 18 Feb 2011, Luiz Henrique de Figueiredo wrote:
> It can be argued that your reader function is not following the implicit
> contract in the manual:
> 	"To signal the end of the chunk, the reader must return NULL"
> Now the manual does not say that the reader function cannot return NULL
> once and later return something else. The code in the Lua core assumed
> it won't. That was the problem.

I note that if the reader function is a simple wrapper around the read(2)
syscall then it is possible for it to return EOF then on a subsequent call
return some data, e.g. if the input is a terminal.

f.anthony.n.finch  <>
Forties, Cromarty, Forth, Tyne, Dogger: Southeasterly 5 to 7, perhaps gale 8
later in Forties, Cromarty and Forth. Moderate or rough, occasionally very
rough in Forties and Cromarty later. Occasional rain. Moderate or good,
occasionally poor.