Implements a lua table slicing facility

This commit is contained in:
Simone Mainardi 2016-07-26 20:07:10 +02:00
parent 106ba35d2c
commit 374d41387a

View file

@ -1577,6 +1577,16 @@ function table.len(table)
return count
end
function table.slice(tbl, first, last, step)
local sliced = {}
for i = first or 1, last or #tbl, step or 1 do
sliced[#sliced+1] = tbl[i]
end
return sliced
end
-- ############################################
-- Redis Utils
-- ############################################