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

[LUA] Global context...?

Discussion in 'Civ5 - SDK / LUA' started by Drawmeus, Nov 14, 2012.

  1. Drawmeus

    Drawmeus Emperor

    Joined:
    Jul 25, 2007
    Messages:
    1,213
    So, I'm a reasonably proficient scripter but new to Lua and new to using it in Civ 5 modding.

    When are scripts in the global context executed? Is it just at game start and on loading the saved game? Less often? More often?

    I put this as the first line in a .lua file:
    Code:
    print ("***************************************************************************Global context!");
    It does print to the log as expected on starting a game and on loading a saved game, but I need to know if I can rely on that.

    I'm having issues with save/load situations with mod-specific data, and I'm considering throwing in an initialization function. Having it fire off when (and only when) the mod starts and when I load a game would be ideal.
     
  2. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,462
    Location:
    Near Portsmouth, UK
    yes (5 chars)
     
  3. Drawmeus

    Drawmeus Emperor

    Joined:
    Jul 25, 2007
    Messages:
    1,213
    Thank you!
     

Share This Page