I want to add an oldValue parameter to DataStore2's ":Update()" method. This is what I currently have now:
function DataStore:Update(updateFunc) updateFunc(DataStore:Get(0)) self.value = updateFunc(self.value) self:_Update() end
But it's still nil (printed). Help?
How i print it:
datastore:Update(function(oldVal) print(oldVal) end)
:_Update()
function which is used for setting data in DS2 (Used by datastore:Set() and datastore:Update() in DS2):
function DataStore:_Update(dontCallOnUpdate) if not dontCallOnUpdate then for _,callback in pairs(self.callbacks) do callback(self.value, self) end end self.haveValue = true self.valueUpdated = true end