Solved Unable to Sort List Variable (Confirmed Skript bug/issue)

  • 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!

Status
Not open for further replies.

Hexivoid

Member
Oct 22, 2017
35
7
8
Fixed in Skript 2.3.6

Edit: Sorting has been broken since 2.2+ (lowest we tested, classified as a medium priority bug) and still isn't working. Check this issue for more information!

Skript Version:
2.3.5
Skript Author: Bensku
Minecraft Version: 1.12.2 (Spigot)

*Please note I might be calling list variables arrays, I'm too used to doing so...

I'm unable to sort a list array (I've been trying to find a solution for many hours today)... I get a "List of type class java.lang.Object does not support sorting" error every time I reload my Skript. I assumed the error meant I would have to parse the values of my list variable to a comparable type, such as text and integers, so I did. I parsed the values in my array as integers/numbers and still get the same error! Please look at the pseudocode below, any help is much appreciated!

Code:
set {play::Hexivoid} to "5" parsed as integer
set {play::Candy} to "7" parsed as integer
set {play::Ramen} to "9" parsed as integer

set {new::*} to sorted {play::*}

SkriptSortError.PNG
 
Last edited:
Is that your full code?
 
This happens when you have different types in the list. For example a string and a number. You can try parsing as a number.
Code:
set {_list::lime} to "1" parsed as number
set {_list::lime2} to "2" parsed as number
set {_list::lime3} to "3" parsed as number
set {_sorted::*} to sorted {_list::*}
If that doesn't work, then the variable you are using {play::*} has other objects within it.
 
  • Like
Reactions: Hexivoid
Is that your full code?

There you go.

Code:
command /test:
    trigger:
        
        delete {play::*}
        set {play::Hexivoid} to "5" parsed as number
        set {play::Candy} to "7" parsed as number
        set {play::Ramen} to "9" parsed as number
 
        set {new::*} to sorted {play::*}
        broadcast "%{new::*}%"
 
Well I'm pretty sure it's a bug:
Code:
command /test:
    trigger:
        set {_l::*} to 1, 3 and 2
        set {_n::*} to sorted {_l::*}
gives 1 error while parsing:
Code:
List of type class java.lang.Object does not support sorting. (pvz.sk, line 98: set {_n::*} to sorted {_l::*}')
it doesn't seem like that should error (Lime your code also gives an error while parsing on 2.3.5).
Simply
Code:
command /test:
    trigger:
        set {_sorted::*} to sorted {_list::*}
gives the same error.
 
Well I'm pretty sure it's a bug:
Code:
command /test:
    trigger:
        set {_l::*} to 1, 3 and 2
        set {_n::*} to sorted {_l::*}
gives 1 error while parsing:
Code:
List of type class java.lang.Object does not support sorting. (pvz.sk, line 98: set {_n::*} to sorted {_l::*}')
it doesn't seem like that should error (Lime your code also gives an error while parsing on 2.3.5).
Simply
Code:
command /test:
    trigger:
        set {_sorted::*} to sorted {_list::*}
gives the same error.
Reported as a bug: https://github.com/SkriptLang/Skript/issues/1904
 
Status
Not open for further replies.