Support macros
Design overview for the recipe support macro system — reusable parameterized blocks that compose into full loadout configs.
What are support macros?
Support macros are small, self-contained recipe fragments that accept typed parameters and expand into concrete configuration blocks at build time. Think of them as functions for your loadout pipeline.
Anatomy
- name — unique identifier used in recipe references
- params — typed input slots (string, int, bool, enum)
- body — template that expands into final config nodes
- outputs — optional named values exposed to parent recipe
Invocation
Recipes invoke macros via the !macro directive. Arguments are passed positionally or by name. The macro body is inlined at the call site before validation runs.
Composability
Macros can call other macros, forming a directed acyclic graph. Circular references are detected at parse time and rejected with a clear error pointing to the cycle.
Validation
Each parameter declares a type and optional constraints (range, regex, allowed values). The macro engine validates all arguments before expansion, surfacing precise error messages with line numbers.