Comparison

util/iterators.lua @ 7184:dedc6bf180e2

util.iterators: Localize unpack() in Lua 5.2 compatible way
author Kim Alvefur <zash@zash.se>
date Mon, 22 Feb 2016 17:38:46 +0100
parent 5776:bd0ff8ae98a8
child 7186:9c3930bcbb72
comparison
equal deleted inserted replaced
7183:b606a5b32e91 7184:dedc6bf180e2
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 unpack = table.unpack or unpack; --luacheck: ignore 113
15 local function pack(...) return { n = select("#", ...), ... }; end 16 local function pack(...) 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 = {};