Property tree

From Official Factorio Wiki
Revision as of 20:39, 20 March 2018 by Rseding91 (talk | contribs)
Jump to navigation Jump to search

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  Data type
0 none n/a
1 bool bool
2 number double
3 string string
4 list array
5 dictionary dict

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