diff options
Diffstat (limited to 'acf2/model/node.lua')
-rw-r--r-- | acf2/model/node.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/acf2/model/node.lua b/acf2/model/node.lua index bb37900..3347cd0 100644 --- a/acf2/model/node.lua +++ b/acf2/model/node.lua @@ -61,7 +61,7 @@ function M.TreeNode:init(context) mt.__eq = equal_tns mt._meta = {} - function mt.get(k, create) return mt.load(k, {create=create}) end + function mt.get(k, options) return mt.load(k, options) end if not mt.txn then return end @@ -101,7 +101,9 @@ function M.TreeNode:fetch(path, create) raise(mt.path, 'Member does not exist: '..name) end - local next = mt.get(name, create) + local options = {create=create} + if create and #path == 1 then options.dereference = false end + local next = mt.get(name, options) if next == nil and (not create or #path > 1) then raise(mt.path, 'Subordinate does not exist: '..name) end |