here is an example code which illustrates the problem:
Code: Select all
reftable = { a="1" }
tabletwo = { reftable = reftable }
tabletwo.reftable.a = 2
DebugPrint(reftable.a)
tablethree = CopyTable(tabletwo)
tablethree.reftable.a = 3
DebugPrint(reftable.a)
First I am making reftable and make it have var "a" that contains number 1.
Then I make Table two, which has reference to reftable.
Now I change tabletwo.reftable.a value to "2". Then I debugprint reftable.a value, which is now 2 as well, as it should be.
However, next I use copytable to make a copy (tablethree) of tabletwo.
When I now go and change value of tablethree.reftable.a to "3", and when I now debugprint reftable.a, value is still "2", when I wanted that to change into "3".
By otherwords, I would like to have a way to make a reference to reftable in such a way, that even when I use CopyTable(), it would still in this tablethree.reftable.a affect also the value of reftable.a.
Is this doable somehow?