From 6de3c67c536be18cf8074040f24181f1823b1295 Mon Sep 17 00:00:00 2001 From: Kaarle Ritvanen Date: Mon, 17 Mar 2014 23:01:52 +0200 Subject: model: split key_removable into two parts --- aconf/model/node.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'aconf/model') diff --git a/aconf/model/node.lua b/aconf/model/node.lua index 62a860c..56b05cb 100644 --- a/aconf/model/node.lua +++ b/aconf/model/node.lua @@ -127,11 +127,13 @@ function M.TreeNode:init(context, params) function mt.removable() return true end + function mt.value_removable(v) + return not isinstance(v, M.TreeNode) or getmetatable(v).removable() + end + function mt.key_removable(k) - local v = mt.load(k, {dereference=false}) - return params.editable and ( - not isinstance(v, M.TreeNode) or getmetatable(v).removable() - ) + return params.editable and + mt.value_removable(mt.load(k, {dereference=false})) end function mt.check_removable(k, v) -- cgit v1.2.3