1mNAME0m
       lindex - Retrieve an element from a list

1mSYNOPSIS0m
       1mlindex 4m22mlist24m 4m?index...?0m

1mDESCRIPTION0m
       The  1mlindex 22mcommand accepts a parameter, 4mlist24m, which it treats as a Tcl
       list. It also accepts zero or more 4mindices24m into the list.  The  indices
       may  be  presented either consecutively on the command line, or grouped
       in a Tcl list and presented as a single argument.

       If no indices are presented, the command takes the form:
              lindex list
       or
              lindex list {}
       In this case, the return value of 1mlindex 22mis simply  the  value  of  the
       4mlist24m parameter.

       When presented with a single index, the 1mlindex 22mcommand treats 4mlist24m as a
       Tcl list and returns the 4mindex24m'th element from  it  (0  refers  to  the
       first element of the list).  In extracting the element, 1mlindex 22mobserves
       the same rules concerning braces and quotes and backslashes as the  Tcl
       command interpreter; however, variable substitution and command substi-
       tution do not occur.  If 4mindex24m is negative or greater than or equal  to
       the  number of elements in 4mvalue24m, then an empty string is returned.  If
       4mindex24m has the value 1mend22m, it refers to the last element in the list, and
       1mend-4m22minteger24m  refers to the last element in the list minus the specified
       integer offset.

       If additional 4mindex24m arguments are supplied, then each argument is  used
       in  turn  to  select  an  element from the previous indexing operation,
       allowing the script to select elements from sublists.  The command,
              lindex $a 1 2 3
       or
              lindex $a {1 2 3}
       is synonymous with
              lindex [lindex [lindex $a 1] 2] 3

1mEXAMPLES0m
              1mlindex 22m{a b c}  4m=>24m 4ma24m 4mb24m 4mc0m
              1mlindex 22m{a b c} {} 4m=>24m 4ma24m 4mb24m 4mc0m
              1mlindex 22m{a b c} 0 4m=>24m 4ma0m
              1mlindex 22m{a b c} 2 4m=>24m 4mc0m
              1mlindex 22m{a b c} end 4m=>24m 4mc0m
              1mlindex 22m{a b c} end-1 4m=>24m 4mb0m
              1mlindex 22m{{a b c} {d e f} {g h i}} 2 1 4m=>24m 4mh0m
              1mlindex 22m{{a b c} {d e f} {g h i}} {2 1} 4m=>24m 4mh0m
              1mlindex 22m{{{a b} {c d}} {{e f} {g h}}} 1 1 0 4m=>24m 4mg0m
              1mlindex 22m{{{a b} {c d}} {{e f} {g h}}} {1 1 0} 4m=>24m 4mg0m

1mSEE ALSO0m
       list(n),  lappend(n),  linsert(n),  llength(n),  lsearch(n),   lset(n),
       lsort(n), lrange(n), lreplace(n)


1mKEYWORDS0m
