data-types
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
data-types [2020/07/07 15:32] – maxime | data-types [2021/06/18 15:46] – maxime | ||
---|---|---|---|
Line 161: | Line 161: | ||
GRASS_CLEAR = true | 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