diff options
Diffstat (limited to 'acf/transaction/backend.lua')
-rw-r--r-- | acf/transaction/backend.lua | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/acf/transaction/backend.lua b/acf/transaction/backend.lua index a8ecfe0..d778a40 100644 --- a/acf/transaction/backend.lua +++ b/acf/transaction/backend.lua @@ -23,8 +23,8 @@ TransactionBackend = require('acf.object').class() function TransactionBackend:init() self.mod_time = {} end -function TransactionBackend:get_if_older(path, timestamp) - local value, ts = self:get(path) +function TransactionBackend:get_if_older(path, timestamp, t) + local value, ts = self:get(path, t) if ts > timestamp then err.raise('conflict', path) end return value, ts end @@ -38,9 +38,15 @@ function TransactionBackend:set_multiple(mods) local timestamp = gen_number() local effective = {} + local function tostr(s) return s ~= nil and tostring(s) or nil end + for _, mod in ipairs(mods) do local path, t, value = unpack(mod) - if t == 'table' or value ~= self:get(path) then + + if t == 'table' or type( + self:get(path) + ) == 'table' or self:get(path, t) ~= value then + table.insert(effective, mod) self.mod_time[path] = timestamp end |