Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Actually remove duplicates from equippedPowers
Browse files Browse the repository at this point in the history
  • Loading branch information
ShamblesSM committed Feb 2, 2023
1 parent 54c4e5c commit 5c83131
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Profile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -753,12 +753,14 @@ function Profile:deserialize(t)
local hash = {}
local res = {}
-- 1. Handle duplicates
for i, v in ipairs(self.equippedPowers) do
for _, v in pairs(self.equippedPowers) do
if (not hash[v]) then
res[#res + 1] = v
hash[v] = true
end
end
self.equippedPowers = res

-- 2. Handle equippedPowers[>=4]
if #self.equippedPowers >= 4 then
for i = #self.equippedPowers, 4, -1 do
Expand Down

0 comments on commit 5c83131

Please sign in to comment.