mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 23:49:33 +00:00
Add dynamic local network api
This commit is contained in:
parent
204246583d
commit
42ab649693
4 changed files with 38 additions and 3 deletions
|
|
@ -3062,9 +3062,22 @@ function table.clone(t, filter)
|
|||
return clone
|
||||
end
|
||||
|
||||
function table.deepcopy(t)
|
||||
local json = require("dkjson")
|
||||
return json.decode(json.encode(t))
|
||||
-- TODO join the code with table.clone
|
||||
function table.deepcopy(orig)
|
||||
local orig_type = type(orig)
|
||||
local copy
|
||||
|
||||
if orig_type == 'table' then
|
||||
copy = {}
|
||||
for orig_key, orig_value in next, orig, nil do
|
||||
copy[table.deepcopy(orig_key)] = table.deepcopy(orig_value)
|
||||
end
|
||||
setmetatable(copy, table.deepcopy(getmetatable(orig)))
|
||||
else -- number, string, boolean, etc
|
||||
copy = orig
|
||||
end
|
||||
|
||||
return copy
|
||||
end
|
||||
|
||||
function toboolean(s)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue