#Getting the length of an nbt array?
1 messages · Page 1 of 1 (latest)
Should I just make it so that the array has its length in its first element and the rest is its elements?
But this limits my array to only be an int array
Yes, you can do /data get <source> <path to array>, if you store the result of that command in a numerical NBT tag or a scoreboard it will be the length of the array. You can do the same for strings.
Oh didn't know that, thanks so much!
You can also do execute store result score <entity> <score> if data <sorce> <path to array>[] make sure you put [] at the end of the path to the array
The [] means you want to select all items in the array and not the array itself
It was phrased a little differently to how you did, but it explained the sane thing
Anyway, the point is that they know how to do it now, so I'm going to close this post
Ol