I’m having some major frustration with an array. My array is composed of 1-12 other arrays. So far, so good. However, when I load the sub-arrays into to main array and later read it back, it’s behavior is a mystery. I will read the right number of sub arrays, but each is an identical copy of the last sub array. I confirmed that each appended sub array is unique as it is added to the main array.
Here’s the code snip:
transferArray is a local to this function
recordarray is a global which gets refreshed by a function called just prior to appending to transferArray.
s = "record array# " + i + ": "
for (local n=0; n < recordarray.len(); n++) s += recordarray[n] + " "
server.log(s) //shows the array being added
transferArray.append(recordarray)
So each different recordarray gets added to the transferArray, confirmed to be unique. Yet when I check later in the code
for (local x=0; x<transferArray.len(); x++)
{
for (local n=0; n<DATA_FIELDS; n++)
{
s += "(" + x + ":" + n + ") " + transferArray[x][n] + " "
}
}
server.log(s) //shows actual contents of transferArray
I get multiple copies of my last entry, not the unique recordarrays that should have appended
Am I missing something obvious? I’d appreciate some suggestions.