diff 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
line wrap: on
line diff
--- a/util/iterators.lua	Thu Oct 06 16:00:39 2022 +0100
+++ b/util/iterators.lua	Thu Oct 06 18:34:40 2022 +0100
@@ -240,7 +240,8 @@
 end
 
 function it.join(f, s, var)
-	return setmetatable({ {f, s, var} }, join_mt);
+	local t = setmetatable({ {f, s, var} }, join_mt);
+	return t, { t, 1 };
 end
 
 return it;