Multidimensional Arrays in Papyrus:
Something I was tinkering around with today. I've tested it and it works. This is only a two-dimensional example, but it should be extendible into three dimensions (and beyond) if you would want to do it. I think this should also be thread-safe to use, which is an extra benefit. This example uses int arrays, but you could make a multidimensional array of any type.
string[] arrayIDsint[] masterArrayint[] array0int[] array1int[] array2int[] array3int[] array4int[] array5int[] array6int[] array7int[] array8int[] array9Event OnInit() array0 = new int[128] array1 = new int[128] array2 = new int[128] array3 = new int[128] array4 = new int[128] array5 = new int[128] array6 = new int[128] array7 = new int[128] array8 = new int[128] array9 = new int[128] arrayIDs = new string[10] arrayIDs[0] = "_array0State" arrayIDs[1] = "_array1State" arrayIDs[2] = "_array2State" arrayIDs[3] = "_array3State" arrayIDs[4] = "_array4State" arrayIDs[5] = "_array5State" arrayIDs[6] = "_array6State" arrayIDs[7] = "_array7State" arrayIDs[8] = "_array8State" arrayIDs[9] = "_array9State"EndEventFunction SomeFunctionOfYours(...) ;do things ;set elements of your multi-dimensional array: MyArray(x)[y] = someInt ;access/use elements of your multi-dimensional array: someActor.setActorValue("Health", MyArray(x)[y]) ;do more thingsEndFunctionint[] function MyArray(int a) goToState(arrayIDs[a]) return masterArrayendFunction;alternative version if you want to use other states in your script (though of course;you'll have to make sure they don't have sensitive begin or endState events in them); int[] function MyArray(int a); string returnState = getState(); goToState(arrayIDs[a]); goToState(returnState); return masterArray; endFunctionState _array0State Event OnBeginState() masterArray = array0 EndEventEndStateState _array1State Event OnBeginState() masterArray = array1 EndEventEndStateState _array2State Event OnBeginState() masterArray = array2 EndEventEndStateState _array3State Event OnBeginState() masterArray = array3 EndEventEndStateState _array4State Event OnBeginState() masterArray = array4 EndEventEndStateState _array5State Event OnBeginState() masterArray = array5 EndEventEndStateState _array6State Event OnBeginState() masterArray = array6 EndEventEndStateState _array7State Event OnBeginState() masterArray = array7 EndEventEndStateState _array8State Event OnBeginState() masterArray = array8 EndEventEndStateState _array9State Event OnBeginState() masterArray = array9 EndEventEndState
Obviously there is still the inconvenience of having to manually define all one-dimensional arrays that make up your multi-dimensional array, along with the corresponding states. Speed-wise, however, I imagine this should still be quite fast, since it doesn't require any latent functions and it's not doing any heavy lifting to accomplish its task.