Code:
-- somewhere at the top, assign a table to a variable
local T = {}
-- somewhere, make a tween
T[A] = tweenobj
-- somewhere else, want the previous A to get out so I can use a new A
A:Cancel()
A:Destroy()
A = nil
-- slightly below above, do my thing
A = newtweenobj
Query:
Often at times, I cache Tween objects into table if I need to operate on them in the future (such as overriding and cancelling tweens to play another one over top). In such a case, I do three things in order:
- Cancel the tween
- Destroy the tween
- Set the indice to nil
Do I really need to do this? I feel like what I’m doing is unnecessary and I don’t understand when or why I started doing this in the first place.