lua-users home
lua-l archive

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


Hello,

if io.read("*n") returns nil (a string can't be converted into a
number), then all subsequent calls to io.read("*n") return nil without
reading the standard input.

Example:
$ lua5.2
Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> print(io.read('*n'))
qwerty
nil
> print(io.read('*n'))
nil
>

Is it a bug?

Calling io.read() "repairs" io.read("*n"), i.e. the next call to
io.read("*n") reads the standard input.

Best regards,
Boris Nagaev