Property tree: Difference between revisions
		
		
		
		Jump to navigation
		Jump to search
		
 PropertyTree file format  | 
				 Add description of types 6 and 7 (new in Factorio 2.0)  | 
				||
| (9 intermediate revisions by 6 users not shown) | |||
| Line 4: | Line 4: | ||
|+PropertyTreeType ([[Data_types#unsigned byte|unsigned byte]])  | |+PropertyTreeType ([[Data_types#unsigned byte|unsigned byte]])  | ||
|-  | |-  | ||
! Value !!   | ! Value !! Name  | ||
|-  | |-  | ||
| 0 || none   | | 0 || [[Property_tree#None|none]]  | ||
|-  | |-  | ||
| 1   | | 1 || [[Property_tree#Bool|bool]]  | ||
|-  | |-  | ||
| 2   | | 2 || [[Property_tree#Number|number]]  | ||
|-  | |-  | ||
| 3   | | 3 || [[Property_tree#String|string]]  | ||
|-  | |-  | ||
| 4   | | 4 || [[Property_tree#List|list]]  | ||
|-  | |-  | ||
| 5   | | 5 || [[Property_tree#Dictionary|dictionary]]  | ||
|-  | |-  | ||
| 6 || [[Property_tree#Signed integer|signed integer]]  | |||
|-  | |||
| 7 || [[Property_tree#Unsigned integer|unsigned integer]]  | |||
|}  | |||
== The file format ==  | == The file format ==  | ||
| Line 37: | Line 41: | ||
=== String ===  | === String ===  | ||
1 [[Data_types#bool|bool]] if   | 1 [[Data_types#bool|bool]] if there is no string - then, if there is a string:  | ||
1 [[Data_types#Space optimized|Space optimized]] [[Data_types#unsigned int|unsigned int]] the size of the string  | 1 [[Data_types#Space optimized|Space optimized]] [[Data_types#unsigned int|unsigned int]] the size of the string  | ||
| Line 51: | Line 55: | ||
For each element:  | For each element:  | ||
1   | 1 '''string''' (See string type above) the dictionary element name or it can be empty if loading a list  | ||
1 [[Property_tree]]  | 1 [[Property_tree]]  | ||
=== Signed integer ===  | |||
1 [[Data_types#long|long]]  | |||
=== Unsigned integer ===  | |||
1 [[Data_types#unsigned long|unsigned long]]  | |||
[[Category:Technical]]  | |||
Latest revision as of 18:30, 27 December 2024
A PropertyTree (the Factorio class name) is a recursive variant format that holds a key <> value pair where the key may be empty and the value may be only one of the following types:
| Value | Name | 
|---|---|
| 0 | none | 
| 1 | bool | 
| 2 | number | 
| 3 | string | 
| 4 | list | 
| 5 | dictionary | 
| 6 | signed integer | 
| 7 | unsigned integer | 
The file format
1 unsigned byte representing the PropertyTreeType.
1 bool the any-type flag (currently not important outside of Factorio internals; default value is false)
Property Tree Type
None
Nothing
Bool
1 bool
Number
1 double
String
1 bool if there is no string - then, if there is a string:
1 Space optimized unsigned int the size of the string
N byte the string contents
List
Identical to Dictionary
Dictionary
1 unsigned int the number of PropertyTree elements
For each element:
1 string (See string type above) the dictionary element name or it can be empty if loading a list
Signed integer
1 long