--- title: neededbuildresources summary: An MD station property giving ware shortages for one particular build task. section: reference kind: api status: reference tags: ["X4","modding","needed","build","resources"] sources: ["https://wiki.egosoft.com/X4%20Foundations%20Wiki/Modding%20Support/"] --- ## Return value | Type | Meaning | | --- | --- | | [MD table](wiki:type-md-values) | The .table form yields an MD table keyed by wares with shortage quantities. It is not a Lua table. | [Types and methods](wiki:types) ## Observed expression Layer: Mission Director. This is a station property for a build task, not a Lua function. `$Station` must exist and `$Build` must be its valid task. The handler must resolve these variables; the fragment does not create them. ```xml ``` **What happens:** $Needed holds this task's shortage table and $Wares its key list. Exact wares and quantities depend on the station/task; there is no fixed printed output. ## Iterate the result The table describes shortages for that order. Station stock, the ware recipe and build-task missing resources are different facts. The example reads each ware ID and the corresponding required amount. ```xml ``` **What happens:** Each $Ware key supplies its ID and shortage quantity $Amount. This example reads data; it does not deliver wares. ## Limits Check task lifecycle and station association first. Do not reuse a handle after completion or cancellation. Handle a valid empty set separately from a missing order. Reading this property should neither create ships nor supply resources; UI display has its own verification.