comparison util/iterators.lua @ 12744:e894677359e5

util.iterators: join: Work even with only a single iterator in the chain
author Matthew Wild <mwild1@gmail.com>
date Thu, 06 Oct 2022 18:34:40 +0100
parents 5eaf77114fdb
children
comparison
equal deleted inserted replaced
12743:19113f232423 12744:e894677359e5
238 table.insert(self, { f, s, var }, 1); 238 table.insert(self, { f, s, var }, 1);
239 return self, { self, 1 }; 239 return self, { self, 1 };
240 end 240 end
241 241
242 function it.join(f, s, var) 242 function it.join(f, s, var)
243 return setmetatable({ {f, s, var} }, join_mt); 243 local t = setmetatable({ {f, s, var} }, join_mt);
244 return t, { t, 1 };
244 end 245 end
245 246
246 return it; 247 return it;