From 3b3ff9408ada91ff04654098be6a253c1dbde440 Mon Sep 17 00:00:00 2001 From: Lordnoobstan <54535659+Lordnoobstan@users.noreply.github.com> Date: Sun, 1 Sep 2024 10:51:35 -0400 Subject: [PATCH] Add `CombinedDataStore:AfterSave` to wrap underlying `DataStore` function of the same name --- DataStore2/init.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/DataStore2/init.lua b/DataStore2/init.lua index d376eca..630f2d0 100644 --- a/DataStore2/init.lua +++ b/DataStore2/init.lua @@ -424,6 +424,16 @@ do function CombinedDataStore:SetBackup(retries) self.combinedStore:SetBackup(retries) end + + function CombinedDataStore:AfterSave(callback) + local function wrappedCallback(save) + local saveValue = save[self.combinedName] + + return callback(saveValue) + end + + self.combinedStore:AfterSave(wrappedCallback) + end end local DataStoreMetatable = {}