DictionaryRemove

(Engine-Level Function)

Description: Removes a key / value pair from a dictionary, providing a means to regain memory space and remove data that is no longer needed.
Returns: Nothing
Usage: Script Only.
Function Groups: Dictionary
Related to: Dictionary | MetaData | DictionaryCopy | GetNextKey | GetKeyCount | HasMetaData | IsDictionary | ListKeys | RootValue
Format: DictionaryRemove ( dictionary,  key );
Parameters:  
Dictionary     
Required. The name of the dictionary.
Key     
Required. The name of the key to be removed.
Comments:

For dictionaries with modules as its value, the module will be deleted when the last reference to the module goes away.
For example:

X = LoadModule(...);
Y = X;
X = Invalid;
Y = Invalid {This is the last reference to the module, so the module gets deleted here};

An alternative method of removing a reference from a dictionary is to assign a different value.

For example, instead of using

DictionaryRemove(MyDictionary, "X")

Set a new value for X directly:

MyDictionary["X"] = "";

Example:

Given a dictionary created as follows:

    X = Dictionary();
    X["A"] = 42;
    X["B"] = 86;
    X["C"] = 99;

The following will remove the key "C" and its value:

    DictionaryRemove(X, "C");