Carpet

Carpet

2M Downloads

Scarpet has() doesn't work on lists

SirGavith opened this issue ยท 3 comments

commented

The scarpet has() method seemingly doesn't work on lists.
For a simple test case, try has(['a'],'a'). You'd expect it to return true but instead it has this error message which makes no sense:

Operand has to be of a numeric type in system chat at pos 1
  HERE>> has(['a'],'a')
Error while evaluating expression

If you try changing the list to an map with a meaningless value like has({'a' -> 1},'a'), then it will return the expected result of true

commented

intended. You're meant to do ['a']~'a'

commented

@SirGavith the has() func is only for checking if a container has a given key.

commented

That makes sense, but it is in the section in the documentation that begins with Here is a list of operations that work on all types of containers: lists, maps, as well as other Minecraft specific modifyable containers, like NBTs, and the error message is somewhat cryptic. If intended, then I suggest a error message that says this, like argument cannot be of type list or something