mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Implements a lua table slicing facility
This commit is contained in:
parent
106ba35d2c
commit
374d41387a
1 changed files with 10 additions and 0 deletions
|
|
@ -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
|
||||
-- ############################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue