summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--acf/transaction/init.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/acf/transaction/init.lua b/acf/transaction/init.lua
index 76a8d47..ca6ca6f 100644
--- a/acf/transaction/init.lua
+++ b/acf/transaction/init.lua
@@ -92,6 +92,7 @@ function Transaction:_set_multiple(mods)
local name = pth.name(path)
local old = self:get(path)
+ local is_table = type(value) == 'table'
local delete = value == nil
if delete then
@@ -111,12 +112,13 @@ function Transaction:_set_multiple(mods)
if type(old) == 'table' then
if delete then
for _, child in ipairs(old) do self:set(pth.join(path, child)) end
- elseif type(value) == 'table' then return
+ elseif is_table then return
elseif #old > 0 then
error('Cannot assign a primitive value to non-leaf node '..path)
end
end
+ if is_table then value = {} end
set(path, value, old == nil)
local function set_parent()