list_table¶
Syntax¶
Parameters¶
<scope>-
The scope of the variable being declared. Valid values for scope are
sharedandagent.Important
For
agent-scoped variables,tableandlist_tablevariable types are currently disabled, as they would be extremely memory-intensive with fairly ordinary numbers of agents.
<variable_name>- A name to give the newly declared variable. If multiple are present, they must be separated by a space. Variable names must start with a letter and contain no symbols.
Description¶
Declares a list_table variable inside of a variables block; that is, a lookup table that holds some number of list values. In a list_table, keys are real numbers, and values are lists.
Values in list_tables can be set and retrieved using the square brackets like so:
# Let's use 1 as the key
my_list_table_variable[1] = list(1, 2, 3, 4)
my_list_variable = my_list_table_variable[1]
# Let's use list(1,2) as the compound key
my_list_table_variable[list(1,2)] = list(5,6)
my_list_variable = my_table_variable[list(1,2)]
# Now my_list_varible is list(5,6)
It is an error to try to retrieve a key that does not exist in the list_table.
Examples¶
The following declares a list_table variable called lookup_table1.