Weird numeric for loop counter variable behavior

  • From: Cheyi Lin <cheyi.lin@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 6 Mar 2014 14:54:38 +0800

Hi, I have a rare numeric for loop variable behavior in LuaJIT 2.0.2:

local N = 4
for i = 1, N do
  if i < 0 or i > 4 then
    print(i, N)  -- Is this possible ??
  end
end

Yes, It really happened a couple of times a week in my project, I got
i = 5 and N = 4 !

How did it happen? Could someone give me some clues/hints?
Thanks.

Cheyi

Other related posts: