lua-users home
lua-l archive

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


On 2012-09-14 2:46 PM, "Roberto Ierusalimschy" <roberto@inf.puc-rio.br> wrote:
>
> > > I get "'for' step must be a number" in both versions.
> >
> > Perhaps I'm misunderstanding something.  I just noticed that Roberto's
> > code actually has inc with a capitalized I in the first line and 1nc
> > with the digit one instead of the capital I in the second.  If I copy
> > that into the interpreter I get the error message you mention in both
> > cases.  If I use Inc with a capital I in both lines then the for loop
> > does the expected thing in both versions of Lua.  If the misspelled
> > Inc is intentional, why wouldn't this raise an error.  Could the digit
> > one followed by letters, a malformed number, be considered a legal
> > token somehow?
>
> My point was exactly that, if the code has some small error (an 'l'
> instead of an 'I'), the proposed change would result in a weird behavior
> without error messages.
>
> (NOTE: The mispelled character in 'lnc' is a small-cap 'L', not the
> digit one.)
>
> -- Roberto
>

Yeah I was confused too; couldn't see any difference there.