1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Skript' started by Hexivoid, Feb 18, 2019.

Thread Status:
Not open for further replies.
  1. Hexivoid

    Hexivoid Member

    Joined:
    Oct 22, 2017
    Messages:
    35
    Likes Received:
    7
    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 (Text):
    1. set {play::Hexivoid} to "5" parsed as integer
    2. set {play::Candy} to "7" parsed as integer
    3. set {play::Ramen} to "9" parsed as integer
    4.  
    5. set {new::*} to sorted {play::*}
    6.  
    SkriptSortError.PNG
     
    #1 Hexivoid, Feb 18, 2019
    Last edited: Mar 10, 2019
  2. TPGamesNL

    Moderator Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    108
    Medals:
    Is that your full code?
     
  3. LimeGlass

    VIP Supporter ++ Regular Diner Addon Developer

    Joined:
    Jan 24, 2017
    Messages:
    623
    Likes Received:
    439
    Medals:
    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 (Text):
    1. set {_list::lime} to "1" parsed as number
    2. set {_list::lime2} to "2" parsed as number
    3. set {_list::lime3} to "3" parsed as number
    4. set {_sorted::*} to sorted {_list::*}
    If that doesn't work, then the variable you are using {play::*} has other objects within it.
     
    Hexivoid likes this.
  4. Hexivoid

    Hexivoid Member

    Joined:
    Oct 22, 2017
    Messages:
    35
    Likes Received:
    7
    There you go.

    Code (Text):
    1. command /test:
    2.     trigger:
    3.        
    4.         delete {play::*}
    5.         set {play::Hexivoid} to "5" parsed as number
    6.         set {play::Candy} to "7" parsed as number
    7.         set {play::Ramen} to "9" parsed as number
    8.  
    9.         set {new::*} to sorted {play::*}
    10.         broadcast "%{new::*}%"
     
  5. TPGamesNL

    Moderator Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    108
    Medals:
    Well I'm pretty sure it's a bug:
    Code (Text):
    1. command /test:
    2.     trigger:
    3.         set {_l::*} to 1, 3 and 2
    4.         set {_n::*} to sorted {_l::*}
    gives 1 error while parsing:
    Code (Text):
    1. 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 (Text):
    1. command /test:
    2.     trigger:
    3.         set {_sorted::*} to sorted {_list::*}
    gives the same error.
     
  6. Hexivoid

    Hexivoid Member

    Joined:
    Oct 22, 2017
    Messages:
    35
    Likes Received:
    7
    Reported as a bug: https://github.com/SkriptLang/Skript/issues/1904
     
Thread Status:
Not open for further replies.

Share This Page

Loading...