Skip to content

Commit

Permalink
Make sure PlayerRemoving doesn't save if it's not changed data
Browse files Browse the repository at this point in the history
  • Loading branch information
Kampfkarren committed Sep 4, 2019
1 parent 461fac8 commit ea50084
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion DataStore2/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,10 @@ do
self:_Update()
end

function CombinedDataStore:Save()
self.combinedStore:Save()
end

function CombinedDataStore:OnUpdate(callback)
if not self.onUpdateCallbacks then
self.onUpdateCallbacks = { callback }
Expand All @@ -525,7 +529,6 @@ do
end

self.combinedStore:_Update(true)
self.valueUpdated = true
end

function CombinedDataStore:SetBackup(retries)
Expand Down
3 changes: 3 additions & 0 deletions Tests/tests/DataStore2.spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,9 @@ return function()
dataStore:Set(2)
dataStore:Save()
expect(timesCalled).to.equal(2)

dataStore:Save()
expect(timesCalled).to.equal(2)
end)
end
end
Expand Down

0 comments on commit ea50084

Please sign in to comment.