If I have a lua table inside a lua table, and I remove all references to the parent table, will the parent & inner table be garbage collected? For example (table inside table):
I’ve looked at several sources but I’m still not 100% sure about this. In my case, these are ‘OOP’ objects where a ‘part’ object contains a ‘timer’ object. If I delete all references to the part object, will this object be garbage collected, together with its timer? Or do I have to set all part object properties to nil.
This not really answers the question , I am already using the oop lua syntax. I was curious as to what is garbage collected when deleting all references to a table that may have subtables.
if all references to “table” are lost it will be collected, then all your elements will also lose their reference, so later they will also be collected. And so on. You don’t need to set their fields to nil.