function DataStore.Debug(M,...)if M.debug then print("\091\068\097\116\097\083\116\111\114\101\050\046\068\101\098\117\103\093",...)end end function DataStore._GetRaw(M)if M.getRawPromise then return M.getRawPromise end M.getRawPromise=((M.savingMethod:Get()):andThen(function(O)M.value=O M:Debug("\118\097\108\117\101 \114\101\099\101\105\118\101\100")M.haveValue=true M.getting=false end)):catch(function(O)M.getting=false M.getRawPromise=nil return Promise.reject(O)end)return M.getRawPromise end function DataStore._Update(O,M)if not M then for M,y in ipairs(O.callbacks)do y(O.value,O)end end O.haveValue=true O.valueUpdated=true end
--Internal functions
function DataStore:Debug(...)
	if self.debug then
		print("[DataStore2.Debug]", ...)
	end
end

function DataStore:_GetRaw()
	if self.getRawPromise then
		return self.getRawPromise
	end

	self.getRawPromise = self.savingMethod
		:Get()
		:andThen(function(value)
			self.value = value
			self:Debug("value received")
			self.haveValue = true
			self.getting = false
		end)
		:catch(function(reason)
			self.getting = false
			self.getRawPromise = nil
			return Promise.reject(reason)
		end)

	return self.getRawPromise
end

function DataStore:_Update(dontCallOnUpdate)
	if not dontCallOnUpdate then
		for _, callback in ipairs(self.callbacks) do
			callback(self.value, self)
		end
	end

	self.haveValue = true
	self.valueUpdated = true
end
