Open sprunk opened 3 months ago
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.
1) 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)
2) create a Spring.Utilities subtable for other similar includes: keysym.h, colors.h[.lua] and apply the same treatment as above to gadgets.
Spring.Utilities
keysym.h
colors.h[.lua]
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.
1) For custom commands, the utilities table exists. Change
into
2) create a
Spring.Utilities
subtable for other similar includes:keysym.h
,colors.h[.lua]
and apply the same treatment as above to gadgets.