libs/core: Add luci.util.create_dtable

This commit is contained in:
Steven Barth 2008-07-28 13:07:22 +00:00
parent 3b29503f13
commit 84ad4e3e21

View file

@ -375,6 +375,19 @@ function clone(object, deep)
return copy
end
--- Create a dynamic table which automatically creates subtables.
-- @return Dynamic Table
function create_dtable()
return setmetatable({}, { __index =
function(tbl, key)
return rawget(tbl, key)
or rawget(rawset(tbl, key, create_dtable()), key)
end
})
end
-- Serialize the contents of a table value.
function _serialize_table(t)
local data = ""