Pazyryk
Deity
- Joined
- Jun 13, 2008
- Messages
- 3,584
I have many little "self-contained" Lua files that do stuff, often in response to an Event or GameEvent, and don't really need to interact with other Lua code (except perhaps accessing some mod data from MapModData). There is an example in this thread where a SerialEventCityCreated listener listens for new city graphic creation and then changes that graphic (in this example, city ArtStyleType).
My question is: Is it better to add these files each in their own state as a separate UIAddIns, or to pile them into my mod's main state with includes? At least in my imagination, different states are able to run in parallel and so the former could allow for parallel processing. I've seen some evidence for this (I think) in the timing of print statements from different states. But I could be wrong (I read somewhere that Lua threads aren't really threads). Perhaps there is no right answer from the "code architecture" point of view and it's just modder preference...
My question is: Is it better to add these files each in their own state as a separate UIAddIns, or to pile them into my mod's main state with includes? At least in my imagination, different states are able to run in parallel and so the former could allow for parallel processing. I've seen some evidence for this (I think) in the timing of print statements from different states. But I could be wrong (I read somewhere that Lua threads aren't really threads). Perhaps there is no right answer from the "code architecture" point of view and it's just modder preference...