Code: Select all
TableModel = { text="text to print"}
Function TableModel:New()
Local o = TableModel
SetMetaTable(o, {__index = TableModel})
Return(o)
EndFunction
Function TableModel:MyPrintFunction()
DebugPrint(self.text)
EndFunction
NewTable = {}
NewTable[1] = {}
NewTable[1].ThisTable = TableModel:New()
CopyOfNewTable = CopyTable(NewTable)
CopyOfNewTable[1].ThisTable:MyPrintFunction()I am not going to copy my whole program, but just point out these three lines which show what happens:
Code: Select all
T_Teams[1].Deck:DrawTopCard()
T_TempTeams = CopyTable(T_Teams)
T_TempTeams[1].Deck:DrawTopCard()
Why did this first example not lose the function, while the second one did, even they seem identical? Also, is this a bug or a feature?