Mercurial > prosody-hg
comparison util/iterators.lua @ 7186:9c3930bcbb72
util.iterators: Use table.pack() on Lua 5.2
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 22 Feb 2016 17:43:40 +0100 |
| parents | dedc6bf180e2 |
| children | 425bc672d60b |
comparison
equal
deleted
inserted
replaced
| 7185:5687788a2e4d | 7186:9c3930bcbb72 |
|---|---|
| 11 local it = {}; | 11 local it = {}; |
| 12 | 12 |
| 13 local t_insert = table.insert; | 13 local t_insert = table.insert; |
| 14 local select, next = select, next; | 14 local select, next = select, next; |
| 15 local unpack = table.unpack or unpack; --luacheck: ignore 113 | 15 local unpack = table.unpack or unpack; --luacheck: ignore 113 |
| 16 local function pack(...) return { n = select("#", ...), ... }; end | 16 local pack = table.pack or function (...) return { n = select("#", ...), ... }; end |
| 17 | 17 |
| 18 -- Reverse an iterator | 18 -- Reverse an iterator |
| 19 function it.reverse(f, s, var) | 19 function it.reverse(f, s, var) |
| 20 local results = {}; | 20 local results = {}; |
| 21 | 21 |
