In theory, should it not be a simple case of creating the ExposedMembers in the Initialize() function and that's all that is necessary.
Each new or loaded game runs this function which in turn creates the references. Tracking initialization and whether table entries have been created seems unnecessary as long as everything is being contained in the one spot.
I could be wrong, so just throwing the observation out there...
Example within my Utils_Units.lua file:
Code:
-- ###############################################################################
-- INITIALIZE FUNCTION
-- ###############################################################################
function Initialize()
print("Initializing Utils_Units")
ExposedMembers.Utils_Units = {}
ExposedMembers.Utils_Units.CreateUnit = CreateUnit
ExposedMembers.Utils_Units.DeleteUnit = DeleteUnit
ExposedMembers.Utils_Units.GetUnitKey = GetUnitKey
ExposedMembers.Utils_Units.GetUnitFromKey = GetUnitFromKey
end
Initialize()
Then I simply call it from the primary script via ExposedMembers.Utils_Unites.CreateUnit(...)