data-types
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
data-types [2020/01/23 13:38] – created maxime | data-types [2021/06/18 15:46] – maxime | ||
---|---|---|---|
Line 146: | Line 146: | ||
| //'' | | //'' | ||
+ | ---- | ||
+ | |||
+ | ==== bitfield ==== | ||
+ | |||
+ | A bitfield is a dictionary with enumeration values of a specific type as keys, and boolean values as value. | ||
+ | |||
+ | When defining a new object, a enumeration value missing from a bitfield table will be considered as false. When [[: | ||
+ | |||
+ | To initialize a bitfield of [[api: | ||
+ | <file lua> | ||
+ | local bitfield = { | ||
+ | DEFAULT = true, | ||
+ | NAVIGABLE = false, | ||
+ | GRASS_CLEAR = true | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ==== list ==== | ||
+ | |||
+ | A list is a collection of values of a specific type. This type can be used to create new properties for [[custom-classes|custom classes]]. The following example shows how to declare a '' | ||
+ | |||
+ | <file lua> | ||
+ | Properties = { | ||
+ | ... | ||
+ | { | ||
+ | Name = " | ||
+ | Type = " | ||
+ | Default = { 1.0, -4.0, 5.0 }, -- default value: list with three float numbers | ||
+ | }, | ||
+ | ... | ||
+ | } | ||
+ | |||
+ | ... | ||
+ | |||
+ | mod: | ||
+ | mod: | ||
+ | </ | ||
+ | |||
+ | ==== fixed_sized_array ==== | ||
+ | |||
+ | A fixed sized array is a list containing a fixed number of values of a specific type. This type of property is specified with it's size (e.g. '' | ||
+ | |||
+ | <file lua> | ||
+ | Properties = { | ||
+ | ... | ||
+ | { | ||
+ | Name = " | ||
+ | Type = " | ||
+ | Default = { " | ||
+ | }, | ||
+ | ... | ||
+ | } | ||
+ | |||
+ | ... | ||
+ | |||
+ | mod: | ||
+ | </ | ||
+ | |||
+ | ==== fixed_sized_map ==== | ||
+ | |||
+ | A fixed sized map is very similar to a fixed sized array, except it can only take enumeration values as keys. For some properties, a maximum key value can be specified. | ||
+ | |||
+ | With a fixed sized map of [[data-types# | ||
+ | |||
+ | <file lua> | ||
+ | someType.MyMapProperty[BUILDING_TYPE.GENERAL] = 4.2 | ||
+ | someType.MyMapProperty[" | ||
+ | </ |
data-types.txt · Last modified: 2023/09/14 14:52 by polymorphgames