lua-users home
lua-l archive

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


ah yeah. that makes a lot of sense.

Thanks!

On 7/18/07, Aaron Brown <arundelo@hotmail.com> wrote:
Zach Dwiel wrote:

> If however, I enter anything not a number, it continues in
> an infinite loop asking for input.  Am I not using io.read
> "*number" correctly?  Is this behavior the desired
> behavior of io.read "*number"?

No to the first question, yes to the second.  You should
only use the "*n" format when you are sure there's nothing
but a number or whitespace to read, so your second approach
is correct.

io.read behaves this way because it uses the C function
fscanf.  See:

  http://c-faq.com/stdio/scanfjam.html

--
Aaron
http://arundelo.com/




--
Zach Dwiel
dwiel.net