Comparison

util/iterators.lua @ 3540:bc139431830b

Monster whitespace commit (beware the whitespace monster).
author Waqas Hussain <waqas20@gmail.com>
date Sat, 16 Oct 2010 23:00:42 +0500
parent 3392:6e31b49c4ab8
child 4386:ce769240f8ec
comparison
equal deleted inserted replaced
3539:8bbd965267b2 3540:bc139431830b
71 while true do 71 while true do
72 local ret = { f(s, var) }; 72 local ret = { f(s, var) };
73 var = ret[1]; 73 var = ret[1];
74 if var == nil then break; end 74 if var == nil then break; end
75 x = x + 1; 75 x = x + 1;
76 end 76 end
77 77
78 return x; 78 return x;
79 end 79 end
80 80
81 -- Return the first n items an iterator returns 81 -- Return the first n items an iterator returns
129 table.insert(t, var); 129 table.insert(t, var);
130 end 130 end
131 return t; 131 return t;
132 end 132 end
133 133
134 -- Treat the return of an iterator as key,value pairs, 134 -- Treat the return of an iterator as key,value pairs,
135 -- and build a table 135 -- and build a table
136 function it2table(f, s, var) 136 function it2table(f, s, var)
137 local t, var = {}; 137 local t, var = {};
138 while true do 138 while true do
139 var, var2 = f(s, var); 139 var, var2 = f(s, var);