lua-users home
lua-l archive

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


Hi!

I think I have found a bug. I am using Lua 4.0.1.
The code below produces an infinite loop.

for _, x in {1} do
  _ = nil
end

Sure, the code does not make sense, but it is a stripped down version
of code that was useful to me.

It seems to have something todo with (mixing?) the _ dummy identifiers.
If I change either of them it works. Changing the first _ to a variable name
is the way I worked around the problem.
If I change nil to 2 I get the following message:

error: invalid key for `next'

It is not a showstopper and the new for code in lua 5 might not have
this problem but I just wanted to let you know anyway.

Thanks for an excellent language!

Mattias