lua-users home
lua-l archive

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


> > Actually, this is more serious than I thought.  In Lua 5.0, 
> this works:
> > 
> > mytable = { 1, 2, 3, 4 }
> > for c in mytable do
> >     print(c)
> > end
> > 
> > In Lua 5.1 work 6, it hangs indefinitely...
> 
> Not in my copy. It just gives
> 	attempt to call a table value
> which is due to the removal of the "for k in table" syntax.
> Try "for c in next,mytable do"
> 
> And I could not reproduce your other examples. Are you 
> running a clean copy of 5.1w6?

Yes.  Visual C++ 7.1.  I just created a console project, added all the
files, compiled, and ran a Debug build.

for c in next,mytable do print(c) end

Prints:

1

and then hangs.

BTW, I'm probably way late to the discussion, but the removal of the "for k
in table" syntax makes default table iteration ugly.  (I actually didn't
know about it...)  Just my rather sad opinion...

Josh