Since the lua garbage collector has been a hot topic lately. I wanted to look at a few areas that I knew were massively abusing the concatenation command in lua.
I decided to do a bit of code cleanup.
The code that sets all the images for the spring commands:
BAD: Each time a unit was created, it would build all image strings.
BETTER: Each image setting is built at initialize and just pulled on unit created from a prebuilt table
The code that sets all the custom tool tips:
BAD: Each time a unit was created, it would build that unit's tooltip and then build the tool tip for each build entry(assuming there was a set of units to build)
BETTER: Tooltips are built at initialize. Now units assign tooltips from a prebuilt table.
The research tree code:
BAD: on each time the mouse cursor is over an item to display the tooltip, it would generate the tool tips.
BETTER: Tooltips are built at initialize. Now it just grabs the tooltip from a reference table.