New and improved TableSaverLoader for persisting Lua data through game exit/load

Pazyryk

Deity
Joined
Jun 13, 2008
Messages
3,584
Version 0.14 is posted in TableSaverLoader's thread. I'm posting here since the thread update will likely slip by unnoticed (as will this post if I don't get a friendly bump ;)).

For those that don't know, TableSaverLoader provides a way to persist Lua table data through game save/load.

For existing users of TableSaverLoader, it's worth updating for the speed increase, which is quite substantial over older versions. For 1800 persisted data elements in Éa with ~100 changing each turn, TableSave takes 0.016 seconds on my computer. And you only pay that overhead at game save (unlike SaveUtils where you pay serialization overhead each time you change some data).

The OP also describes how to (successfully) intercept game saves using Lua only, which has been an ongoing headache and the hardest part in using TableSaverLoader. Alternatively for dll modders, I've provided code for a GameEvents.GameSave hook that fires before the dll serializes Civ5SavedGameDatabase.db into the Civ5Save file.

Feel free to ask general questions here, or specific installation questions in the mod's thread.
 
Great!

I think some modders got scared away before due to the messiness of catching game saves. I didn't really know how to intercept autosaves (which normally happen in barb turn after unit moves) and I had you modding SaveGame.lua to deal with regular saves. But now I've figured out how to catch all saves successfully with Lua only and adding code in one place only - so it's much simpler now. (And if you are a dll modder, it's even easier with a GameSave event that I describe.)
 
Back
Top Bottom