lua-users home
lua-l archive

Re: xml pull parser

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


Rici wrote:
> By the way, I lied a little bit. You can actually specify
> the first iteration-key argument to the iterator function
> as well, but by convention iterator functions use nil as
> the "start of iteration" marker.
Here's an example that makes use of something other than
nil. The following code iterates through all two-member
subsets of the Beatles; the trick is that the inner loop
starts partway through the table.
Beatles = {
 John = "rhythm",
 Paul = "bass",
 George = "lead",
 Ringo = "drums"}
for p1, i1 in next, Beatles, nil do
 for p2, i2 in next, Beatles, p1 do
 print(p1, i1, p2, i2)
 end -- for
end -- for
-- 
Aaron
"PHP combines the orthogonality of sh with the elegance
of <font color=ad0000> Fatal error: Cannot redeclare
quuxitate() (previously declared in -:4) in - on line 6
</font>

AltStyle によって変換されたページ (->オリジナル) /