Difference between revisions of "SHIP:Data Types:Node"

From Serious Documentation
Jump to: navigation, search
 
(5 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
*[[SHIP:Data_Types|All Data Types]]
 
*[[SHIP:Data_Types|All Data Types]]
  
== {{DataType|Reference}} ==
+
== {{DataType|Node}} ==
 
<onlyinclude>{{DataTypeTableStart|}}
 
<onlyinclude>{{DataTypeTableStart|}}
|{{DataType|Reference}}||Reference to a [[SHIP:Node|node]] or one of its properties.
+
|{{DataType|Node}}||Reference to a [[SHIP:Node|node]].
|}
+
|}</onlyinclude>
Properties and parameters that are of type {{DataType|Reference}} must receive a value that is known at SHIPTide time, not a value that is dynamically assigned at run time. For example, the following statement will fail:
+
In general, functions that require parameters of type {{DataType|Node}} must receive a value that is known at SHIPTide time, not a value that is dynamically assigned at run time. For example, the following statement will fail:
<code>
+
<code>{{SailFunc|getChildIndex}}({{SailFunc|getChild}}(myParent, index));    // fails instead of returning index</code>
[[SHIP:Sail:getChildIndex|getChildIndex]]([[SHIP:Sail:getChild|getChild]](myParent, index));    // fails instead of returning index
 
</code>
 
  
The above code is illegal since [[SHIP:Sail:getChildIndex|getChildIndex]] expects a {{DataType|Reference}} to a [[SHIP:Node|node]] but [[SHIP:Sail:getChild|getChild]] returns the [[SHIP:Node|node]] itself.</onlyinclude>
+
The above code is illegal since {{SailFunc|getChildIndex}} expects a static reference to a [[SHIP:Node|node]], not one created at runtime through the {{SailFunc|getChild}} function.

Latest revision as of 05:36, 14 July 2014

See Also

Node

Data Type Description
Node Reference to a node.

In general, functions that require parameters of type Node must receive a value that is known at SHIPTide time, not a value that is dynamically assigned at run time. For example, the following statement will fail:

getChildIndex(getChild(myParent, index));    // fails instead of returning index

The above code is illegal since getChildIndex expects a static reference to a node, not one created at runtime through the getChild function.