lua-users home
lua-l archive

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


I've noticed a little problem with my common debug idiom of
foreach(t,print)
Here is the difference between 4.1 alpha and beta:

$ lua 
Lua 4.1 (alpha)  Copyright (C) 1994-2001 TeCGraf, PUC-Rio
> t = { 1, 2, 3, 4, 5 }
> foreach( t, print )
1       1
2       2
3       3
4       4
5       5
> 
$ ./lua
Lua 4.1 (beta)  Copyright (C) 1994-2001 TeCGraf, PUC-Rio
> t = { 1, 2, 3, 4, 5 }
> foreach( t, print )
1       1
3       3
5       5
> 

I assume that this is due to print calling tonumber which confuses the
next within foreach.

But all things considered, the new 4.1 is absolutely fantastic.  concat
is good, but don't forget to add it to the manual.

I converted my text template code that used a number of upvalues to be
lexically scoped, and it worked without a hitch.  This code was inspired
by your test/examples/www/staff.lua example, but I added some things to
make it almost on par with Text::Template.pm by MJ Dominus.  Now that
there are no more upvalues, the code is much more understandable.  It's
available at http://www3.sympatico.ca/pshook/lua/ for those who are
interested.

- Peter