Code: Select all
mytable = {}
mytable[1] = {}
mytable[1].test = "yep"
reftable = mytable[1]
DebugPrint(reftable.test)
reftable.another = "another"
DebugPrint(mytable[1].another)
reftable = {}
DebugPrint(mytable[1].test)
DebugPrint(reftable.test)
Code: Select all
reftable = {}
So how can I empty the original table using reference, or do I have to manually empty every item from it?
Point is that this table is holding several number in it: table = {1, 2, 3, 4, 5}, and as I am assigning new numbers to it, of what there might be different amount than there is currently, I was wanting to first empty that table before assigning the new numbers inside to avoid one of the old numbers staying there.
As example:
oldtable = {1, 2, 3, 4, 5, 6}
Newtable = {10, 20, 30, 40}
except now when I replace the old one with new one, I end up with:
NewTable = {10,20, 30, 40, 5, 6}