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"
> 	http://www.lua.org/manual/5.1/manual.html#lua_Reader
>
> 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.

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
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.