Pseudo Mutli-Dimensional Array (3D)

From Second Life Wiki
Revision as of 16:30, 21 August 2009 by Sandie Harbour (talk | contribs)
Jump to navigation Jump to search

In my previous article Pseudo Multi-Dimensional Array, I discussed how to acheive 2 dimensional array behavior in LSL. In this article, we will look at doing the same for a 3 dimensional array.

A list is defined as “a heterogeneous list of the other data types”. It is linear by nature and can be thought of as a single column.

At the physical level, arrays are stored in contiguous sections of memory. (Another linear structure) An algorithm is used to translate between the logical rows and columns and the physical level of addresses.

Consider a list with 48 elements. Normally we visualize this as a vertical column. In this case, it is convenient to think of them as 2 tables of 4 rows and 6 columns. Notice we are starting with element 1. Element zero is reserved for storing the size of the array.