mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Implements new nindex table slice
This commit is contained in:
parent
8f84202a43
commit
c985fbf62b
1 changed files with 18 additions and 0 deletions
|
|
@ -4340,9 +4340,27 @@ function iec104_typeids2str(c)
|
|||
return(c)
|
||||
end
|
||||
|
||||
function table.slice(t, start_table, end_table)
|
||||
if t == nil then
|
||||
error("The array to slice cannot be nil!")
|
||||
end
|
||||
|
||||
if start_table < 1 or end_table > #t then
|
||||
error("Invalid bounds!")
|
||||
end
|
||||
|
||||
local res = {}
|
||||
for i = start_table, end_table, 1 do
|
||||
res[#res + 1] = t[i]
|
||||
end
|
||||
|
||||
return res
|
||||
end
|
||||
|
||||
--
|
||||
-- IMPORTANT
|
||||
-- Leave it at the end so it can use the functions
|
||||
-- defined in this file
|
||||
--
|
||||
http_lint = require "http_lint"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue