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

Guide to TCL scripting for Eggdrop 1.6

[ Previous ] [ Index ] [ Next ]

8.1 What lists are

A list is simply said a set of objects, unlike a string which is a set of characters. The object on itself can be a string again or another list with a new set of objects.
These objects are usually seperated by spaces, but they can contain spaces themselves too. Where an object in a list starts and stops can be defined with open and close braces.

The commands that will be discussed in the paragraphs 8.3, 8.4, 8.5 and 8.6 treat what they receive as input as lists.
This means that if you input something into it that has braces in it, it will see this as the start and end of an object within the list, so be carefull with these commands when you are processing nicknames for example.

It will also add braces if required, like for instance when you have brackets in what you input into the command, in that case braces are added to mark the start and end of an object.

A small example:
If you were to have the list "test {foo bar} temp", than the first object of this list would be "test", the second "foo bar" (not "{foo" and "bar}", because the braces mark the start and end of the object) and the third "temp".

Like said above, an object can also contain a new list with new objects. This might seem strange but I'll give an example.
If you were to have the list "test {foo {foo bar}} temp" than "foo {foo bar}" would be the second object.
If you were to break that apart again than the first object would be "foo" and the second "foo bar" and so on. Just think of it like having a large box, with a smaller box inside that one and an even smaller box inside that one again. Pretty much the principle of a Russian Matryoshka doll if you know what that is :-).

Lists can be contained within strings, but they can also be the output of a command.
The most important thing is to watch out with the commands you're using and know whether they are processing what you put into them as a list or a string and whether they output it as a list or a string, because if they process it as a list you will have to make sure the objects in it are the way you want them and not have unforseen braces, brackets or spaces that mess the whole thing up.

[ Previous ] [ Index ] [ Next ]

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