[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Strange io.read behaviour
- From: Patrick Donnelly <batrick@...>
- Date: Mon, 22 Mar 2010 17:04:58 -0400
What Sam said and:
On Mon, Mar 22, 2010 at 4:07 PM, Tim Channon <tc@gpsl.net> wrote:
> On investigation
>
> print(f:read("*n") 40
> print(f:read("*n") nil
> print(f:read("*l") astring
>
> What is going on?
>
The second call to f:read("*n") skips all the whitespace "\r\n" (moves
the file position) trying to find a number to read. It fails because
"astring" is not a number. Thus, the next time you read a line you get
"astring".
--
- Patrick Donnelly