I tried to pass some values from Table A to Table B, and then things happend confused me
Code:
A,B={},{}
A[1]=1
B=A
At this point, I think Table B got the value "1" from Table A. And then:
I thought that I assigned the value 2 to Table A
AFTER I assigned Table A to Table B, so that Table B won't get the value 2. But no, I ran the script, and found that Table B is totally equal to Table A, no matter how much values I assign to Table A after that.
So that confused me. Is it a rule that when I wrote B=A, the Table B will change realtimely according to Table A till the end of the world?
Do I have to change the "B=A" to
Code:
for i=1,#A do
B[i]=A[i]
end