#Data Accessing Question

1 messages · Page 1 of 1 (latest)

gaunt fractal
#

I know you can access the first element of an array using /data (get/modify/remove) (storage/entity) path[0], but is there a simple way to access the last element of an array?

gaunt fractal
#

theres a way i can implement what im doing that doesnt require it, but it'd make the end result a bit less fun, so i'd prefer to be able to do that

#

honestly i could use some documentation on minecraft's data structure in general im not sure where to find that

#

oh wait just remembered the datapack wiki exists

#

that has general information on the data structure

#

doesnt answer the main question though

#

i suppose i could just track the length of the list independently as i add and remove items and macro that into the index value if there isnt a better solution

icy karma
#

you can access the last element of an array by using [-1]

gaunt fractal
#

oh for real?

#

nice

#

thank you!