Skip to content

Commit

Permalink
Prevent duplicate modification entries in message
Browse files Browse the repository at this point in the history
  • Loading branch information
Dadido3 committed Feb 5, 2024
1 parent 45df692 commit 24a1615
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion files/message.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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:"}
Expand Down

0 comments on commit 24a1615

Please sign in to comment.