-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Set (data type)
Christoph Heine edited this page Mar 29, 2018
·
3 revisions
Sets are one of the complex data types supported by nyan. A set is a collection of elements that does not allow duplicates. It can hold an unlimited number of values.
set_name : set(type) = {value1, value2, ..}
The contents of a set are surrounded by curly brackets ({}
). Each value is seperated by a comma (,
).
All values must be of the same data type specified with type
.
Building():
creates : set(Unit)
Barracks(Building):
creates = {Militia, Spearman}
The set creates
has two entries: Militia
and Spearman
. Values inserted into the set must be of type Unit
.
Building():
creates : set(Unit)
Barracks(Building):
creates = {Militia, Spearman}
Overwrites the old value with a new one.
Barracks(Building):
creates = {Militia, Spearman}
MesoBarracks<Barracks>():
creates += {EagleWarrior}
Inserts the given values into the set.
ArcheryRange(Building):
creates = {Archer, Skirmisher, Genitour}
AllyLeaves<ArcheryRange>():
creates -= {Genitour}
Removes every value that matches the values in the given set.
ArcheryRange(Building):
creates = {Archer, Skirmisher, CavalryArcher, HandCannoneer}
BackToFeudalAge<ArcheryRange>():
creates &= {Archer, Skirmisher}
Removes every value that not matches the values in the given set.