local A, B = 1, {} -- A is 1, B is an empty table.
-- Insert the value of A into B. No position was indicated, so it will be placed in B[table size + 1]
table.insert(B, A)
print(B[1]) -- Output: 1
B[1] = 2 -- B[1] = 2, overwriting its previous value.
print(A) -- Output: 1
print(B[1]) -- Output: 2
You cannot expect A to be overwritten. A and B[1] are pointing to different locations in memory. Therefore, you must do one of the following for A to be 2.
Nope! Again, A and B are pointing to two different locations in memory.
By saying A = B, you are setting the value of A to the value of B, overwriting the old value of A.
The wiki is a great place to find more information on variables.