Prevent duplicate modification entries in message

This commit is contained in:
David Vogel 2024-02-05 16:14:48 +01:00
parent 45df692b96
commit 24a1615706

View File

@ -192,8 +192,19 @@ function Message:ShowModificationUnsupported(realm, name, value)
Type = "warning",
}
-- Create or append to list of modifications.
-- We have to prevent duplicate entries.
self.List["ModificationFailed"].ModificationEntries = self.List["ModificationFailed"].ModificationEntries or {}
table.insert(self.List["ModificationFailed"].ModificationEntries, {realm = realm, name = name, value = value})
local found
for _, modEntry in ipairs(self.List["ModificationFailed"].ModificationEntries) do
if modEntry.realm == realm and modEntry.name == name then
found = true
break
end
end
if not found then
table.insert(self.List["ModificationFailed"].ModificationEntries, {realm = realm, name = name, value = value})
end
-- Build message lines.
self.List["ModificationFailed"].Lines = {"The mod couldn't apply the following changes:"}