Values and expressions#
Many MD attributes contain expressions. XML quotes delimit the attribute, while inner single quotes make an MD string literal. Lists and tables have different access patterns: $Items.{1} reads a list position; $ByID.{$Key} reads a named table key.
<set_value name="$Label" exact="'Hello, X4'" />
<set_value name="$Count" exact="3" />
<set_value name="$Ready" exact="false" />
<set_value name="$Items" exact="[]" />
<set_value name="$ByID" exact="table[]" />Validate the request shape#
The example checks the incoming UI payload inside its handler. A correct list length does not prove element types. Validate the text and switch value before applying a setting.
<do_if value="typeof $Payload == datatype.list and $Payload.count == 2">
<set_value name="$Label" exact="$Payload.{1}" />
<set_value name="$Enabled" exact="$Payload.{2}" />
</do_if>Existence and scope#
not $Records? checks variable existence. Objects additionally need .exists. A cue reference such as Init.$Records explicitly selects context. False, an empty list and a missing variable are distinct states; do not substitute a content check for existence.
A property can depend on context#
Crew research found that an intermediate npctemplateentry assignment lost needed context. Reading the full property path directly from the ship worked. This is a finding about one pseudoproperty, not a rule that MD never permits intermediate variables. Isolate questionable expressions and compare their game results.