Software / code / prosody
Comparison
util/iterators.lua @ 4441:a01b7207cb37
util.iterators: it2table: Fix variable name
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 07 Dec 2011 05:17:39 +0000 |
| parent | 4386:ce769240f8ec |
| child | 4545:c9b91ddc9c11 |
comparison
equal
deleted
inserted
replaced
| 4440:c60ed6732b34 | 4441:a01b7207cb37 |
|---|---|
| 138 end | 138 end |
| 139 | 139 |
| 140 -- Treat the return of an iterator as key,value pairs, | 140 -- Treat the return of an iterator as key,value pairs, |
| 141 -- and build a table | 141 -- and build a table |
| 142 function it2table(f, s, var) | 142 function it2table(f, s, var) |
| 143 local t, var = {}; | 143 local t, var2 = {}; |
| 144 while true do | 144 while true do |
| 145 var, var2 = f(s, var); | 145 var, var2 = f(s, var); |
| 146 if var == nil then break; end | 146 if var == nil then break; end |
| 147 t[var] = var2; | 147 t[var] = var2; |
| 148 end | 148 end |