diff options
-rw-r--r-- | aconf/model/node.lua | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/aconf/model/node.lua b/aconf/model/node.lua index 327f582..9b69571 100644 --- a/aconf/model/node.lua +++ b/aconf/model/node.lua @@ -66,26 +66,6 @@ function M.TreeNode:init(context, params) mt.name = pth.name(mt.path) mt.__eq = equal_tns - function mt.meta() - if not mt._meta then - mt._meta = {type=params.dtype} - if mt.txn then - if mt.parent then - mt._meta['ui-name'] = - getmetatable(mt.parent).mmeta(mt.name)['ui-name'] - end - mt.init_meta(mt._meta) - end - end - - local res = copy(mt._meta) - res.removable = {} - for _, key in ipairs(mt.members()) do - if mt.key_removable(key) then table.insert(res.removable, key) end - end - return res - end - function mt.get(k, options) return mt.load(k, options) end function mt.fetch(path, create) @@ -148,6 +128,26 @@ function M.TreeNode:init(context, params) end end + function mt.meta() + if not mt._meta then + mt._meta = {type=params.dtype} + if mt.txn then + if mt.parent then + mt._meta['ui-name'] = + getmetatable(mt.parent).mmeta(mt.name)['ui-name'] + end + mt.init_meta(mt._meta) + end + end + + local res = copy(mt._meta) + res.removable = {} + for _, key in ipairs(mt.members()) do + if mt.key_removable(key) then table.insert(res.removable, key) end + end + return res + end + if not mt.txn then return end function mt.save(k, v) rawset(self, k, v) end |