Hi
This is a pointless bit of code, but apart from that, is there anything wrong or potentially dangerous with the following?
t = 5 t = nil t = 6
I’m asking because my app has several different activities from which the user can choose via a main menu. The code for each activity is in its own lua file, as a giant table. When a user is done with one activity and returns to the menu, I nil out all of the variables that were in use in that activity. When the user returns later to it, the same variables get re-used. I’m not sure that this is a good way to approach this, but I’m wondering if there’s actually anything wrong with it.
thanks,
David
p.s related question: is it possible to have a dangling pointer in Lua? What if I did this. Would “b” be a dangling pointer?
a = {1,2,3} b = a -- b[1] = 1 a = nil -- could b[1] now be changed in some unpredictable way?