Zero-K
Zero-K copied to clipboard
Replace `include("bla.h")` with `Spring.Utilities.Bla`
Including the file over and over in each gadget recreates the whole table (-> waste of cycles, garbage collector pressure) and pollutes the gadget with a ton of mostly useless globals.
For custom commands, the utilities table exists. Change
VFS.Include("LuaRules/Configs/customcmds.h")
Spring.Echo(CMD_FOO)
into
local CMD_FOO = Spring.Utilities.CMD.FOO
Spring.Echo(CMD_FOO)
- create a
Spring.Utilities
subtable for other similar includes:keysym.h
,colors.h[.lua]
and apply the same treatment as above to gadgets.