Spring.ENEMY_UNITS does not work as a team ID parameter in Spring API calls. The correct approach uses Spring.GetLocalTeamID and Spring.GetTeamUnitsByDefs with commander unit definition IDs to find enemy commanders.
Tags: BAR lua scripting, Spring.GetTeamUnitsByDefs, enemy commander tracking, team IDs, beyond all reason
Spring.ENEMY_UNITS is not a valid team ID for Spring API functions. Use Spring.GetLocalTeamID to get your team, then iterate through all possible team IDs to find enemy teams. The Spring engine does not provide a direct enemy team list, so build it by excluding your team ID from the full range.
Once you have enemy team IDs, use Spring.GetTeamUnitsByDefs with a list of commander unit definition IDs. The pattern builds an array like UnitDefNames['corcom'].id and UnitDefNames['armcom'].id, then passes them to the function with each enemy team ID. This returns the unit IDs of all visible enemy commanders.
New Spring engine and Lua modders do not need to download the full BAR source to start writing widgets. The installed game provides access to the Lua scripting library. The source code becomes useful for understanding unit definitions and gadget implementations but is not required for basic widget development.
Deep technical questions about BAR internals get answered here instead of dismissed. That is the difference between a community that grows its players and one that does not.
[Crd] Before discovering Creed, I was thinking the only thing that separates BAR from the perfect RTS is a friendly and safe social environment for new players to learn and feel included.