8.3 Retrieving an object from a list
Gettings object from lists is fairly easy. The command for this is lindex.
The syntax of a lindex command is lindex <list> <number>.
The <list> is the list from where the object must be retrieved.
This can be anything from a string containing a list ($test can contain a list for example by putting the
output of a list command in it with set) to a command, just as long as it's a valid list and not a
The <number> is the number of the object you want to retrieve.
Each object in the list has its own number, starting at 0. The first object is 0, the second 1, the third 2,
and so on. It's a bit confusing, but if you're used to programming this will seem familiar.
A small example: lindex $test 5 returns the 6th object from the list that is in $test.
The lindex command outputs a string containing only the object itself without the open and close
braces that mark the start and stop of the object if those are present in the list.