Software / code / prosody
Comparison
util/iterators.lua @ 7188:e8f20be3e6f8
Merge 0.10->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 22 Feb 2016 18:46:59 +0100 |
| parent | 7186:9c3930bcbb72 |
| child | 7257:425bc672d60b |
comparison
equal
deleted
inserted
replaced
| 7179:bfa3b2ee384c | 7188:e8f20be3e6f8 |
|---|---|
| 9 --[[ Iterators ]]-- | 9 --[[ Iterators ]]-- |
| 10 | 10 |
| 11 local it = {}; | 11 local it = {}; |
| 12 | 12 |
| 13 local t_insert = table.insert; | 13 local t_insert = table.insert; |
| 14 local select, unpack, next = select, unpack, next; | 14 local select, next = select, next; |
| 15 local function pack(...) return { n = select("#", ...), ... }; end | 15 local unpack = table.unpack or unpack; --luacheck: ignore 113 |
| 16 local pack = table.pack or function (...) return { n = select("#", ...), ... }; end | |
| 16 | 17 |
| 17 -- Reverse an iterator | 18 -- Reverse an iterator |
| 18 function it.reverse(f, s, var) | 19 function it.reverse(f, s, var) |
| 19 local results = {}; | 20 local results = {}; |
| 20 | 21 |