AMX Assigning a 2-Dim Array to Another 2-Dim Array Does Not Work in NetLinx
Written by Peter Stauber
Updated at January 14th, 2026
Table of Contents
Symptoms
Assigning the value of a 2-dim array to another similar 2-dim array does not work in NetLinx.
Example:
DEFINE_VARIABLE
ARRAY1[2][10] = {{'hello '},{'goodbye'}}
ARRAY2[2][10] = {{'i am the'},{'walrus'}}
DEFINE_PROGRAM
WAIT 20
{
ARRAY2 = ARRAY1 // this line will not work, generates run-time error
SEND_STRING 0,"ARRAY2[1],ARRAY2[2]"
} // end
The error generated will look something like this:
(0000097391) GetString - Error 1 Tk=0x0000
(0000097392) CopyString (Reference) - Error 2 S=0x0000 D=0x1033
Resolution
Use a FOR loop to copy each sub-array one at time:
Example:
DEFINE_VARIABLE
ARRAY1[2][10] = {{'hello '},{'goodbye'}}
ARRAY2[2][10] = {{'i am the '},{'walrus'}}
INDEX
DEFINE_PROGRAM
WAIT 20
{
FOR (INDEX = 1; INDEX <=2; INDEX++)
{
ARRAY2[INDEX] = ARRAY1[INDEX]
}
SEND_STRING 0,"ARRAY2[1],ARRAY2[2]"
} // end
Related Videos
Table of Contents