A table is a two-dimensional array of values indexed by types. Indices can be any pair of unit, material, or terrain type. The set of tables is fixed by Xconq, and all are described below.
Form: table
table-name items...
This is the general form to fill in a table.
The table named by table-name is filled in from the items.
If an item is an atom, then every position in the
table is filled in with that item, overwriting any
previously-specified values.
If an item is a list, it must be a three-element list
of the form (type1 type2 value)
.
If both type1 and type2 are single types,
then value will be put into the table at the position
indexed by the two types.
If one of type1 or type2 evaluates to a list,
Xconq will iterate over all members of the list while
keeping the other type constant,
while if both type1 and type2 are lists,
then Xconq will iterate over all pairs from the two lists.
The values used during iteration depend on whether the value
is a list. If value is an atom, then that value will just
be used on every iteration. If a list, then Xconq will
use successive elements of the list while iterating.
If the first member of items is the symbol add
,
then the rest of the items will add to the existing contents
of the table rather than clearing to its default value first.
The following forms are all equivalent:
(table foo (a y 1) (b y 2) (c y 3) (a z 9) (b z 9) (c z 9)) (table foo ((a b c) y (1 2 3)) ((a b c) (z) 9)) (define v1 (a b c)) (table foo (v1 y (1 2 3)) (v1 z 9)) (table foo ((a b c) (y z) ((1 2 3) (9 9 9)))) (table foo (a y 1) (b y 2) (c y 3)) (table foo add ((a b c) z 9))