diff --git a/CHANGELOG.md b/CHANGELOG.md index 87e1c75..061e258 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # DataKeep +## [version 3.0.5](https://github.com/noahrepublic/DataKeep/releases/tag/v3.0.5): 02/13/2024 + +### Fixed + +- GlobalUpdates returning nil causing an error + ## [version 3.0.4](https://github.com/noahrepublic/DataKeep/releases/tag/v3.0.4): 01/21/2024 ### Fixed diff --git a/src/Keep.lua b/src/Keep.lua index da8b0ce..465c022 100644 --- a/src/Keep.lua +++ b/src/Keep.lua @@ -542,32 +542,26 @@ function Keep:_save(newestData: KeepStruct, release: boolean) -- used to interna return resolve() end) end - - --local processors = {} local processUpdates = {} -- we want to run them in batch, so half are saved and half aren't incase of specific needs - for i = 1, #globalUpdates do - if not globalUpdates[i].Locked then - self.GlobalStateProcessor(globalUpdates[i].Data, function() - table.insert(processUpdates, function() - lockGlobalUpdate(i) - end) - end, function() - table.insert(processUpdates, function() - removeLockedUpdate(i, globalUpdates[i].ID) + if globalUpdates then + for i = 1, #globalUpdates do + if not globalUpdates[i].Locked then + self.GlobalStateProcessor(globalUpdates[i].Data, function() + table.insert(processUpdates, function() + lockGlobalUpdate(i) + end) + end, function() + table.insert(processUpdates, function() + removeLockedUpdate(i, globalUpdates[i].ID) + end) end) - end) - - --table.insert(processors, processor) + end end + else + self.GlobalUpdates = DefaultGlobalUpdates end - -- Promise.all(processors):andThen(function() - -- Promise.all(processUpdates):timeout(1 / 60):catch(function() - -- error("GlobalUpdate processor cannot yield") - -- end) -- run in bulk - -- end) - for _, updateProcessor in processUpdates do updateProcessor() end diff --git a/wally.toml b/wally.toml index 65a01cf..9f63f03 100644 --- a/wally.toml +++ b/wally.toml @@ -1,7 +1,7 @@ [package] name = "noahrepublic/datakeep" description = "The final data saving solution you need" -version = "3.0.4" +version = "3.0.5" license = "MIT" authors = ["noahrepublic"] registry = "https://github.com/UpliftGames/wally-index"