Thread: quick question
View Single Post
  #2  
Old 03-22-2001, 06:47 AM
kyle0654 kyle0654 is offline
-. .`
kyle0654's Avatar
Join Date: Mar 2001
Posts: 1,000
kyle0654 will become famous soon enough
NPC Code:

myarray=1;
myarray[0]=1;
myarray[1]=5;
myarray[2]=67;

mything=myarray;



mything would equal 1 after this code. It reads myarray and a variable, but will read myarray[#] as a position in the array myarray. If you want to copy an array to another array, do this:

NPC Code:

myarray = {1, 5, 67};
setarray myarray2, arraylen(myarray);
for (this.z = 0; this.z < arraylen(myarray); this.z++) {
myarray2[this.z] = myarray[this.z];
}



That should work. I haven't actually used setarray in a while though...I'm used to doing it the quick way like I did in the first line of that.
Reply With Quote