projects
/
oweals
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3b29503
)
libs/core: Add luci.util.create_dtable
author
Steven Barth
<steven@midlink.org>
Mon, 28 Jul 2008 13:07:22 +0000
(13:07 +0000)
committer
Steven Barth
<steven@midlink.org>
Mon, 28 Jul 2008 13:07:22 +0000
(13:07 +0000)
libs/core/luasrc/util.lua
patch
|
blob
|
history
diff --git
a/libs/core/luasrc/util.lua
b/libs/core/luasrc/util.lua
index 48b6fa063cffc625c1a00f6ff188f15aae369d79..22f295d23f4613dbd5803fa9f3a7f24cb1bad1f1 100644
(file)
--- a/
libs/core/luasrc/util.lua
+++ b/
libs/core/luasrc/util.lua
@@
-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 = ""