It could be garbage collected if the scope of the variable was more precisely analyzed (not just "lexically" where you may want to reuse its value by adding code within that scope, but by effective area of use in that lexical scope).
Of course, got it!
Actually I like that there is no optimization: it makes Lua light while giving the programmer more control on what is going on under the hood.
As you say, if you deem the variable not useful anymore, you can set it to nil. And static analysis can always help.
Thank you for explaining.