Sorting multidimensional lists?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Liam Jacobs

Member
Jan 26, 2021
2
0
1
26
This is an issue I've run into a couple of times and had to create work-arounds for, and I'm wondering if there's not something I'm missing?

I'm aware that you can sort a list normally via:
code_language.skript:
set {warps::*} to sorted {warps::*}

However, sometimes you'll have multidimensional lists, and it'd be nice to be able to sort all of the lists based on the values held in one. For example:

{warps::names::*} contains the name of each warp.
{warps::visitors::*} contains an integer.

Is it possible to sort both lists by the values in "visitors?"

For example, if it were unsorted:
{warps::names::1} - "World"
{warps::visitors::1} - 12

{warps::names::2} - "Hello"
{warps::visitors::2} - 15

{warps::names::3} - "Wow!"
{warps::visitors::3} - 52

Sorted by "visitors":
{warps::names::1} - "Wow!"
{warps::visitors::1} - 52

{warps::names::2} - "Hello"
{warps::visitors::2} - 15

{warps::names::3} - "World"
{warps::visitors::3} - 12
 
Hello!

I think you might be forced to make a workaround like the other times, such as comparing the numbers every time someone visits a warp and then re-ordering them manually, but I've only spent a few hours tweaking with loop variables so I might also be missing something.
This is an issue I've run into a couple of times and had to create work-arounds for, and I'm wondering if there's not something I'm missing?

I'm aware that you can sort a list normally via:
code_language.skript:
set {warps::*} to sorted {warps::*}

However, sometimes you'll have multidimensional lists, and it'd be nice to be able to sort all of the lists based on the values held in one. For example:

{warps::names::*} contains the name of each warp.
{warps::visitors::*} contains an integer.

Is it possible to sort both lists by the values in "visitors?"