Idk if this is what you’re trying to achieve, but if you’re trying to make a general-purpose multidimensional array, it can be done simply by converting it into a one-dimensional array:
The size of the array is the product of the resolution (size) of all axes (e.g. resX * resY for 2D, and resX * resY * resZ for 3D).
And here are the indexing functions for 2-dimensional & 3-dimensional arrays, which include both coordinate-to-index and index-to-coordinate:
Coordinate-to-index converts a multidimensional coordinate into a one-dimensional coordinate (i.e. the index in the one-dimensional array), and index-to-coordinate does the opposite.
This also allows you to convert between dimensions; e.g. to convert from 2D to 3D, do 2D->1D->3D.
This is a solution for someone like who is not really good at math like me and want a self made multimensional array solution: But hey, your comment here could be useful for other people who has a better understanding of math.
Sorry, should’ve posted an actual example.
The first image shows the utility functions, and the second image shows how to use them.
For your case, you only need the Setup & CoordToIndex functions; the IndexToCoord is an extra utility.
What I’m trying to do and I’m sorry for not understanding you in the first comment, is to show a how to have a multi purpose multidimensional array, not just for numbers but anything else.
Edit: maybe my naming scheme was not the best and i’m also sorry for that too.