This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Struct Type ====== A struct is a container that bundles multiple named values, possibly of different types, into a single value. Each item is retrieved from a struct by name using the matching **Extract Struct** functor for its type. A struct's main use is as the output of [[Calculate Python Expression]] and [[Calculate R Expression]]. An external Python or R script can produce more than one result in a single run, so both functors collect everything the script assigns to ''dinamica.outputs'' into one struct, returned through a single ''result'' output port. Each named value is then unpacked downstream with the extractor matching its type: [[Extract Struct Number]] for a [[Real Value Type|Real Value]], [[Extract Struct String]] for a [[String Type|String]], [[Extract Struct Table]] for a [[Table Type|Table]], [[Extract Struct Tuple]] for a [[Tuple Type|Tuple]], and [[Extract Struct Lookup Table]] for a [[Lookup Table Type|Lookup Table]]. Each takes the struct and the item's name, and fails if the struct has no item under that name with that type. ===== GUI Editor ===== A struct cannot be edited. As with [[Map Type|Map]] and [[Categorical Map Type|Categorical Map]], its carrier functor's own input is non-editable — a struct can only be produced by connecting the output of another functor, never typed in directly. ===== EGO Script ===== Since a struct can't be edited, it also can't be written as a literal in a script. It's always obtained by calling a functor that produces one, and reused by referencing the variable bound to its output: <code> result := CalculatePythonExpression code; total := ExtractStructNumber result "total"; label := ExtractStructString result "label"; </code> ===== Automatic Conversions ===== Structs can't be converted to or from any other type. See [[type_system|Type System]] for the complete conversion reference across all types.