Pairs a value with a given key in an SRP Hash Table.

Syntax

SRP_HashTable("Set", Handle, Key, Value)

Parameters

ParameterDescription
HandleHandle to an existing SRP Hash Table(REQUIRED)
KeyThe key the uniquely identifies the given value (REQUIRED)
ValueThe value paired to the given key (OPTIONAL)

Remarks

The Set service establishes a key-value pair relationship. If the key already exists, then it's value is replaced with the given value. If it does not exist, then it is created and paired with the given value. If you omit the Value, then "" is stored in it's place. Why store empty values? Sometimes you just want to store keys, particularly if you have a process that needs to keep track of unique values.

Examples

// Create a case-insensitive hash table
Handle = SRP_HashTable("Create")

// Set the chores to be done on each day of the week
// Note that Sunday is created but it's paired value is ""
SRP_HashTable("Set", Handle, "Sunday")
SRP_HashTable("Set", Handle, "Monday", "Vacuum")
SRP_HashTable("Set", Handle, "Tuesday", "Take out garbage")
SRP_HashTable("Set", Handle, "Wednesday", "Mow the lawn")
SRP_HashTable("Set", Handle, "Thursday", "Clean bathroom")
SRP_HashTable("Set", Handle, "Friday", "Dust")
SRP_HashTable("Set", Handle, "Saturday", "Have fun!")
 
// Clean up when we're all done
SRP_HashTable("Release", Handle)
  • No labels