# Lists

### What are lists?

Lists are just like regular lists; They can contain elements. Here's a list, in human-readable form.

\
\===========================

* Bot
* Maker
* For
* Discord

\===========================

At position #0 of the list lays "Bot"

At position #3 of the list lays "Discord"

\*Use "Get List Element" to get the elements of a list\*

Got the hang of it yet? Great!

## Sorting Lists

This one's pretty complicated - it takes some understanding, but I'll try my best provide some insight.\\

<figure><img src="https://3630983663-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FV8n2YWDOMg5qcY6xzDbw%2Fuploads%2F1Ip7kSlYM4PbThNilOcn%2Felectron_6EipEY5a9k.png?alt=media&#x26;token=9c48209e-9b11-4be7-83f5-0d50348034d4" alt=""><figcaption></figcaption></figure>

That is the sort list action. You might wonder what "sort value of iteration" means, which is fair.

Every iteration, you need to output a value. That value will have to be the sort value. For example, I can place a "Get Member Data" action inside "for each iteration, run" and make it's output the sort value

Since this is hard to explain, here's some rawdata:

<details>

<summary>Rawdata</summary>

```json
    {
  "name": "sort_by_xp",
  "type": "action",
  "trigger": "textCommand",
  "actions": [
    {
      "name": "Get Guild Members List",
      "file": "getGuildMembersList.js",
      "data": {
        "name": "Get Guild Members List",
        "get": "Variables",
        "store": {
          "type": "temporary",
          "value": "Members"
        }
      },
      "id": 1705769663591
    },
    {
      "name": "Sort List",
      "file": "sortList.js",
      "data": {
        "name": "Sort List",
        "list": {
          "type": "tempVar",
          "value": "Members"
        },
        "sortType": "Increasing Numerically",
        "storeIterationAs": {
          "type": "temporary",
          "value": ""
        },
        "storeValueAs": {
          "type": "temporary",
          "value": "Member"
        },
        "actions": [
          {
            "name": "Get Member Data",
            "file": "getMemberData.js",
            "data": {
              "name": "Get Member Data",
              "user": {
                "type": "tempVar",
                "value": "Member"
              },
              "dataName": "XP",
              "defaultValue": "0",
              "store": {
                "type": "temporary",
                "value": "Sort Value (XP)"
              }
            },
            "id": 1705769658891
          }
        ],
        "sortValue": {
          "type": "tempVar",
          "value": "Sort Value (XP)"
        },
        "store": {
          "type": "temporary",
          "value": ""
        }
      },
      "id": 1705769522609
    }
  ],
  "customId": 1705769521588,
  "boundary": {
    "worksIn": "guild",
    "limits": []
  },
  "parameters": [],
  "description": "No Description"
} 
```

</details>
