The LookupTable intrinsic class provides a general-purpose hash table implementation. LookupTable can be used syntactically as though it were a list, but the index values are arbitrary hash key values rather than being limited to sequential integers.
LookupTable : Collection
Superclass Tree (in declaration order)
Summary of Properties
Summary of Methods
Apply the given function to each entry, and replace the value of the entry with the return value of the function. The callback is invoked with the key and value as arguments for each entry: func(key, value). No return value.
Invoke the given function with each entry in the table. The function is invoked with value of an entry as its argument: func(value). Any return value of the function is ignored. No return value.
Invoke the given function with each entry in the table, passing the key and value to the callback. The function is invoked with key and value of an entry as its arguments: func(key, value). Any return value of the function is ignored. No return value.
Get the number of buckets (i.e., slots for unique hash values). The number of buckets doesn't vary over the life of the table, so this simply returns the number of buckets that was specified in the constructor when the table was created. This can be used to create a new table with the same parameters as an existing table.
Get the default value. This returns the value previously set with setDefaultValue(), or nil if no explicit default has been set on this table.
Get the number of entries. This returns the number of key/value pairs stored in the table. Note that this is not the same as the initial capacity specified in the constructor when the table was created; this is the number of entries actually stored in the table.
Determine if a given key is present in the table. Returns true if the key is present, nil if not.
Make a list of all of my keys. The return value is a list, in arbitrary order, of all of the keys in the table.
Get the nth key. This returns the key that would appear at the given index in the keysToList() result.
Get the enth value. This returns the value that would appear at the given index in the valsToList() result.
Remove an entry from the table. Removes the key/value pair associated with the given key, and returns the value that was associated with the key. If the key isn't present in the table, the return value is nil, and the method has no other effect.
Set the default value. This changes the value returned by the index operator (self[key]) for a key that doesn't exist in the table. The default value is initially nil, but you can change this to a different value of any type if desired.
Make a list of all of my values. The return value is a list, in arbitrary order, of all of the values in the table.
TADS 3 Library Manual
Generated on 5/16/2013 from TADS version 3.1.3