Carpet

Carpet

2M Downloads

Passing a list to `number()` always returns null

tioalexis opened this issue ยท 2 comments

commented

Versions used:

  • fabric-api-0.37.2+1.17.jar (client and server)
  • fabric-carpet-1.17.1-1.4.45+v210811.jar (client and server)
  • carpet-extra-1.17.1-1.4.43.jar (client and server)
/script run number([])
= null

/script run number(['foo', 'bar'])
= null

According to this document, it should return the number of elements in the list: https://github.com/gnembon/fabric-carpet/blob/master/docs/scarpet/language/SystemFunctions.md#numberexpr

This happens even when carpet is the only mod installed (aside from the Fabric API) on a single player world.

commented

if (v instanceof NumericValue num)

Seems like it only checks if it's a numeric value and not the other types.

commented

fixed by #1100