FindOption()
Summary
Finds an option and its setting in an array of name-value pairs.
Syntax
option = FindOption(array options, string option_name)
| Argument | Contents |
|---|---|
| options | An array of name-value pairs |
| option_name | The name of the option being sought in the array |
Returns
An array that contains the location of the desired option in the list of options, and the complete entry from that list.
| Element | Type | Contents |
|---|---|---|
| 1 | Integer | An index (n) into the options array |
| 2 | Array | The corresponding element of the options array |
Notes
-
If the named option does not appear in the list, FindOption() returns null.
-
Comparison is always case insensitive and only up to the length of the option_name string.
-
Nested options are not found. If there is an option Company.Address.Street, Street would not be found but Address would be found.
Example
// Here's a typical option array...
opts = { {"Color", ColorRGB(0,0,0)},
{"Line Width", 4.5},
{"Priority", "-Population"}
}
// To locate a particular option:
opt = FindOption(opts, "Line Width")
// opt is now equal to {2, {"Line Width", 4.5}}
See Also
| Function | Summary |
|---|---|
| FindOptionValue() | Finds the value of a particular option in an options array |