How to set all variables and functions to nil in a module after you finish using it

How to set everything to nil in a module after you finish using it

If it’s really necessary to set it al to nil, I suggest putting all the Variables into 1 table, and then looping through the table and setting all of it’s values to nil. Example:

for _, var in next, self.Variables do
    var = nil
end;

this isn’t setting the variables to nil
try this

for Index in next, self.Variables do
    self.Variables[Index] = nil
end

I’ve just noticed that it’s not setting them to nil.

This is because “var” becomes a reference to the variable which is storing that value & isn’t the variable itself.

1 Like