SUNiNET - Your Eggdrop & TCL resources site
[ Home Eggdrop TCL Links About ]

Guide to TCL scripting for Eggdrop 1.6


[ Previous ] [ Index ] [ Next ]


8.4 Retrieving multiple objects from a list

When you want to get more than one object we just change the command a bit. For this we use the command lrange.
The syntax of a lrange command is lrange <list> <start number> <end number>.

The <list> is the list from which the objects must be retrieved just like with the lindex command.

The <start number> is the number of the object from which the command should start cutting the list.
The numbering of the objects works in the same way as they do in the lindex command.

The <end number> is the number of the object at which the command should stop cutting the list.
Instead of a number you can also use the word end. This makes the command cut from the given start object until the end of the list.

A small example: lrange $test 3 7 returns the objects 4 through 8 from the list that is in $test or lrange $test 4 end would return the objects 5 and up until the end of the list in $test.

The lrange command outputs a newly compiled list of the objects you choose, leaving any open and close braces to mark the start and stop of an object which were already in the list intact and adds new ones if neccesary.


[ Previous ] [ Index ] [ Next ]


Design & Graphics by Shawn Borton
Copyright © 2000-2005 Marijn van Zon