function DataStore.Save(A)if not A.valueUpdated then return end if A.backup then return end if A.value~=nil then local O=clone(A.value)if A.beforeSave then local s,W=pcall(A.beforeSave,O,A)if s then O=W else return end end if not Verifier.warnIfInvalid(O)then return warn("\073\110\118\097\108\105\100 \100\097\116\097 \119\104\105\108\101 \115\097\118\105\110\103")end local s,W=A.savingMethod:Set(O)if not s then end for s,W in pairs(A.afterSave)do local q,U=pcall(W,O,A)if not q then end end end end

function DataStore:Save()
	if not self.valueUpdated then
		--warn(("Data store %s was not saved as it was not updated."):format(self.Name))
		return
	end

	if self.backup then
		--warn("This data store is a backup store, and thus will not be saved.")
		return
	end

	if self.value ~= nil then
		local save = clone(self.value)

		if self.beforeSave then
			local success, newSave = pcall(self.beforeSave, save, self)

			if success then
				save = newSave
			else
				--warn("Error on BeforeSave: "..newSave)
				return
			end
		end

		if not Verifier.warnIfInvalid(save) then return warn("Invalid data while saving") end

		local success, problem = self.savingMethod:Set(save)

		if not success then
			-- TODO: Something more robust than this
			--error("save error! " .. tostring(problem))
		end

		for _, afterSave in pairs(self.afterSave) do
			local success, err = pcall(afterSave, save, self)

			if not success then
				--warn("Error on AfterSave: "..err)
			end
		end

		--print("saved "..self.Name)
	end
end
