List Functions

List functions are able to edit the contents of lists and also return certain information about the specified list. These contents are individually referred to as "items".

## .add(item)

The most basic function for lists. It will add whatever item you specify to the end of whatever list you specify.

**Example:**

```
do {list[example]}.add(Hello!)
do {list[example]}.add(Hey!)
chat {list[example]}

```

This series of events will add "Hello!" to the list "example" and then output the text "[Hello!,Hey!]" because those are the only two items on the list. The brackets are the borders of the lists and will always be there when you output a full list into chat.

## .clear()

In addition to the previous function, this one will simply clear the entire list.

**Example:**

```
do {list[example]}.clear()
chat {list[example]}

```

This series of events will first clear the list, and then output in chat "[]" since there's nothing in the list.

*Note: this function has no parameter.*

## .size()

This function will output the size of the list. It isn't particularly useful in *do* event types. It's more useful in *if* statements.

**Example:**

```
if ({list[example]}.size() == 10)
  do {list[example]}.clear()
  chat Successful
end

```

This series of events will check if the size of the given list is equal to 10 and if it is then output that the event was successful into chat.

*Note: this function has no parameter.*

## .get(number)

This one will allow you to get a specific item number in the list. You need to put the item number of the list in the parenthesis for it to work. Keep in mind that this function is zero based or zero-indexed, which means the first item on the list will correspond to the number 0.

**Example:**

```
do {list[example]}.add(Why hello there)
do {list[example]}.add(Fancy meeting you here)
chat {list[example]}.get(0)

```

This series of events will first add two items to the list. It will then output in chat the first item in the list, which would be "Why hello there" into chat. Note that the output of the .get() function will not include brackets like when you output a whole list into chat.

## .remove(item/number)

This function will allow you to remove a specific item from the list in two different ways. You can put a specific item in the function and it will remove it from the list, or you can put in a specific item number from the list. This is also zero-indexed so the first item will correspond to 0.

**Example:**

```
do {list[example]}.add(What a fine day)
do {list[example]}.add(we're having)
do {list[example]}.add(isn't it?)
do {list[example]}.remove(isn't it?)
chat {list[example]}

```

This series of events will add those three items to the list. Then it will remove the last one and output the list in chat. Only "[What a fine day,we're having]" will output due to the last one being removed.

## .sort()

This function is very useful when keeping things organized. When used, it will automatically sort the list alphabetically.

**Example:**

```
do {list[example]}.add(b)
do {list[example]}.add(c)
do {list[example]}.add(a)
do {list[example]}.sort()
chat {list[example]}

```

In this series of events it will first add b, c and a to the list in order. Then it will sort them alphabetically. When it outputs into chat it will be "[a,b,c]". Perfectly organized!

*Note: this function has no parameter.*

## .has(item)

This function will check if the specified list has a specific item. Like .get(item), this is more useful in *if* statements.

**Example:**

```
do {list[example]}.add(Cake)
if ({list[example]}.has(Cake))
  chat That cake is a lie!
end

```

In this series of events, it will first add Cake to the list. Then it'll check if the list has "Cake". If it does, it'll output that the cake is a lie.

## .load([item1,item2])

This function will override whatever is currently on the list with whatever you specify. This one can be multiple values if you wish. This can also be used to import text files from a specified location on your computer if you replace the items with the location of the file.

**Example:**

```
do {list[example]}.load([Nice,to,meet,you])
chat {list[example]}

```

These two events will first set the entire list to the specified items and then output the list in chat, which would come out "[Nice,to,meet,you]".

## .export(file location)

You can use this function to export a list to a specified file location.