1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

SaveUtils.lua -- Itemized Data Storage Across Mods

Discussion in 'Civ5 - SDK / LUA' started by Whys, Oct 20, 2010.

  1. daviiadams

    daviiadams Prince

    Joined:
    Jul 7, 2011
    Messages:
    369
    Location:
    London
    No worries, I'd taken it in the light hearted manner of the response anyway :)

    I may have come undone, in that one apsect relies on a concatanation of player ID numbers to form unique keys, whereas the other just uses player IDs, so a quick look has me of the opinion that outside of saving both tables within a mother table(?) one of them will have to go :-S
     
  2. DonQuiche

    DonQuiche Emperor

    Joined:
    May 23, 2011
    Messages:
    1,122
    There is an error in the code. The standard lua interpreter can live with it but LuaJIT does stumble on it: on line 511 to 514 of SaveUtils.lua, the "\[" escapes are wrong and must be replaced by "["
     
  3. daviiadams

    daviiadams Prince

    Joined:
    Jul 7, 2011
    Messages:
    369
    Location:
    London
    Is that a mistake I've made, a result of using an old version (as included in Culture Diffusion v6), or just something with SaveUtils?
     
  4. DonQuiche

    DonQuiche Emperor

    Joined:
    May 23, 2011
    Messages:
    1,122
    The only thing I know is that this error does exist on the code within the spoiler markup on the first page. I initially discovered it by debugging a log for Reseed from a user who has CivUP and LuaJIT enabled, CivUP being the one that includes SaveUtils.

    As for who did it and such, I am not familiar enough with this library or your own work. If you are unsure whether your version does have this error or not, just search for the "\[" character pair.
     
  5. daviiadams

    daviiadams Prince

    Joined:
    Jul 7, 2011
    Messages:
    369
    Location:
    London
    Will do :)

    I'd split things into seperate mods anyway, but it'll be something I'll bear in mind in future
     
  6. KevinJK

    KevinJK Warlord

    Joined:
    Nov 23, 2010
    Messages:
    121
    Thank you for this work!

    You didn't say to do this, but I've always been curious about what my stuff is used for in other games, so I thought I'd let you know that I used this to save the number of panels discovered for the Viking Sagas trait in my Denmark Exploration mod. You've been credited at the bottom of the page.

    Again, thank you. SaveUtils is very impressive.
     
  7. Whys

    Whys Between the Lines

    Joined:
    Oct 20, 2007
    Messages:
    456
    There must be NO ESCAPE! :lol:

    I gave up on Civ5 a long time ago, so there's zero chance I'm going to make any improvements to the posted code. That said, I appreciate that SaveUtils continues to make a difference in the community.

    Incidentally, I've noticed some modders have stripped the caching functionality from their SaveUtils implementation. If modders wish to get the most out of what SaveUtils has to offer, then the caching functionality and existing global functions should be left intact. To this end, modders should also implement ShareData to make the cache accessible to all lua states and concurrent mods.

    In the simplest terms, the Save object makes it possible to itemize data storage, while the Cache object improves performance, and ShareData makes it all accessible to all lua states. The global functions streamline the interaction between the three and provide helpful error and warning messages. But I digress.
     

Share This Page