Software /
code /
prosody
Comparison
util/iterators.lua @ 5583:78dbece77ce8
util.iterators: Small fix for variable scoping issue
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 17 May 2013 08:42:21 +0100 |
parent | 5582:7bc2009fdd0c |
child | 5776:bd0ff8ae98a8 |
comparison
equal
deleted
inserted
replaced
5582:7bc2009fdd0c | 5583:78dbece77ce8 |
---|---|
73 --[[ Return the number of items an iterator returns ]]-- | 73 --[[ Return the number of items an iterator returns ]]-- |
74 function it.count(f, s, var) | 74 function it.count(f, s, var) |
75 local x = 0; | 75 local x = 0; |
76 | 76 |
77 while true do | 77 while true do |
78 local var = f(s, var); | 78 var = f(s, var); |
79 if var == nil then break; end | 79 if var == nil then break; end |
80 x = x + 1; | 80 x = x + 1; |
81 end | 81 end |
82 | 82 |
83 return x; | 83 return x; |