diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/core/luasrc/util.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/core/luasrc/util.lua b/libs/core/luasrc/util.lua index 48b6fa063c..22f295d23f 100644 --- 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 = "" |