diff options
-rw-r--r-- | acf/model/node.lua | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/acf/model/node.lua b/acf/model/node.lua index 09e3d69..b73cf52 100644 --- a/acf/model/node.lua +++ b/acf/model/node.lua @@ -74,12 +74,16 @@ end function TreeNode:search(path) if #path == 0 then return self end + + local cpath = getmetatable(self).path local name = path[1] local next = self[name] - if next == nil then - raise(getmetatable(self).path, 'Subordinate does not exist: '..name) - end + if next == nil then raise(cpath, 'Subordinate does not exist: '..name) end + table.remove(path, 1) + if #path > 0 and type(next) ~= 'table' then + raise(pth.join(cpath, name), 'Is a primitive value') + end return TreeNode.search(next, path) end |