Skript: The parse-time type checking in the sorted list expression is broken (the logic is reversed)

Created on 1 Aug 2018  路  4Comments  路  Source: SkriptLang/Skript

https://github.com/SkriptLang/Skript/blob/e5211400c6ca34a84c6dab140bdde9416a75ba04/src/main/java/ch/njol/skript/expressions/ExprSortedList.java#L57-L60

There should be a ! at the beginning of the if. The lack of it makes the expression parse when it (mostly) shouldn't and not parse when it should. I don't think this needs any more proof, but anyway, as an example, sorted 1 and 2 doesn't work without adding the ! (aka currently).

It can't however be simply fixed by adding the ! since the init method's type checking seems to be more broken (or variables are), refer to this script which works without the fix and doesn't work after it:

on load:
    set {_x::*} to 6, 3, 9
    send "%sorted {_x::*}%"

The error after adding the !:

[14:38:34 ERROR]: List of type class java.lang.Object does not support sorting. (test.sk, line 16: send "%sorted {_x::*}%"')

The super type of the items in the list variables seems to be determined to be an Object (instead of something like an Integer, Long or Number)

bug completed medium

Most helpful comment

I know it's useless here, but still wanted to share this x)

All 4 comments

We're probably better off removing the parse-time check and failing silently when the list in question isn't comparable.

You're actually trying to send a message to nobody on a load event

Lol @Matocolotoe, this doesn't affect the issue, but nice catch thanks 馃帀

I know it's useless here, but still wanted to share this x)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

wohahobg picture wohahobg  路  3Comments

ghost picture ghost  路  3Comments

Misio12320 picture Misio12320  路  3Comments

Anarchick picture Anarchick  路  3Comments