Return value#

Type Meaning
MD table The .table form yields an MD table keyed by wares with shortage quantities. It is not a Lua table.

Types and methods

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
<set_value name="$Needed"
           exact="$Station.neededbuildresources.{$Build}.table" />
<set_value name="$Wares" exact="$Needed.keys.list" />

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
<do_for_each name="$Ware" in="$Wares">
  <set_value name="$WareID" exact="$Ware.id" />
  <set_value name="$Amount" exact="$Needed.{$Ware}" />
</do_for_each>

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.