MetaData

Note: Depending on the context in which it is used, this command has two different functions.

Description:              If used with a variable which is not currently a dictionary, this command attached meta data to that variable, thereby creating a dictionary object. The primary purpose in this case is to provide a means of associating extended data with a variable.

                             If used with a variable which is currently a dictionary, this command will return the value associated with the specified key.

Returns:                    Varies – see description

Usage:                       Script

Format:                      MetaData( dictionary, key,  [case sensitive] );

Parameters:             Dictionary     { text }  { required }  { no default }

                                      A variable name that will become the dictionary.

                                    Key    { varies }  { required }  { no default }

                                      Any data type, but it is highly recommended that you use either a string or an integer. This will become the first key within the dictionary.

                                    Case sensitive    { Boolean }  { optional }  { default: 1 }

                                      An optional Boolean, indicating that the dictionary should use case sensitive keys. 1 indicates non-case sensitive while 0 indicates case sensitive.

Example 1: Adding meta data to a variable

    X  =  42;    { X is an integer variable with the value 42 }

    MetaData(X, “A”,  1 ) = 10;

  X becomes a non-case sensitive dictionary having a root value which is the integer 42 and possessing one key, “A”, that has the value 10.

 

Example 2:  Retrieving the meta data from a dictionary

    X  =  Dictionary(5);

    X[“A”]  =  42;

    Y = MetaData(X, “A”);

Y will now hold the integer 42, being the value stored with the key “A” in the dictionary X.     

 

See Also:

Dictionary