Confirmation behaviors (#774)

This commit is contained in:
boatbomber
2023-08-20 12:37:40 -07:00
committed by GitHub
parent c9ab933a23
commit c43726bc75
8 changed files with 280 additions and 39 deletions

View File

@@ -116,7 +116,7 @@ function PatchSet.containsId(patchSet, instanceMap, id)
end
--[[
Tells whether the given PatchSet contains changes to the given instance.
Tells whether the given PatchSet contains changes to the given instance.
If the given InstanceMap does not contain the instance, this function always returns false.
]]
function PatchSet.containsInstance(patchSet, instanceMap, instance)
@@ -235,6 +235,28 @@ function PatchSet.countChanges(patch)
return count
end
--[[
Count the number of instances affected by the given PatchSet.
]]
function PatchSet.countInstances(patch)
local count = 0
-- Added instances
for _ in patch.added do
count += 1
end
-- Removed instances
for _ in patch.removed do
count += 1
end
-- Updated instances
for _ in patch.updated do
count += 1
end
return count
end
--[[
Merge multiple PatchSet objects into the given PatchSet.
]]