Property tree: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
|+PropertyTreeType ([[Data_types#unsigned byte|unsigned byte]])
|+PropertyTreeType ([[Data_types#unsigned byte|unsigned byte]])
|-
|-
! Value !! Name !! Data type
! Value !! Name
|-
|-
| 0 || none || n/a
| 0 || [[Property_tree#None|none]]
|-
|-
| 1 || bool || [[Data_types#bool|bool]]
| 1 || [[Property_tree#Bool|bool]]
|-
|-
| 2 || number || [[Data_types#double|double]]
| 2 || [[Property_tree#Number|number]]
|-
|-
| 3 || string || [[Data_types#string|string]]
| 3 || [[Property_tree#String|string]]
|-
|-
| 4 || list || [[Data_types#array|array]]
| 4 || [[Property_tree#List|list]]
|-
|-
| 5 || dictionary || [[Data_types#dict|dict]]
| 5 || [[Property_tree#Dictionary|dictionary]]
|}
|}



Revision as of 20:40, 20 March 2018

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:

PropertyTreeType (unsigned byte)
Value Name
0 none
1 bool
2 number
3 string
4 list
5 dictionary

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 the string is empty - if not empty:

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 the dictionary element name or it can be empty if loading a list

1 Property_tree