I have a module script that contains all of the functions for my gui event handler local script. This module script is now erroring because the variable limit has been surpassed. I was rather surprised when this happened, but, because it did, I needed to find a way around it. All the variable definitions are wanted and used. This is a module script that has references to most of the guis in the game, along with references to remotes, objects, and various other things, so simply using fewer variables is not going to cut it.
As always, I did some discussion and research before posting this question. There were two main solutions that people came up with. Those are what I wish to ask about. Which one is best in performance, code convention, and general code simplicity?
Option One:
Use a do end block / don't define variables locally. Now, both options are not ideal, but if they're the best, I'll definitely take them, because they're not that difficult to implement. For example, instead of defining player locally, I could do this:
player = players.LocalPlayer
or this:
do
player = players.LocalPlayer
end
Now, I don't see a significant difference between the two (other than the second seeming worse and useless), but I'll leave it up here because it was a suggestion someone made.
Option Two:
Use a table. Now, this option makes sense, but it does mean rewriting large portions of my code, which I'd like to avoid. Not only that, but how exactly should I implement tables? Should I have a different table for each chunk of variables that deal with similar things? Should I do that, but also put each different table into one main table? Should I just put everything into one main table? Should I leave some variable definitions, but move others into tables?
I'd appreciate advice on this matter. If you have a different solution altogether, feel free to post that as well. I'm open to pretty much anything that makes sense, works, and isn't going to require a massive overhaul of the whole system (which seemed pretty smooth until I ran into this limit).
Thanks!

5 comments
It seems the tables are your best bet, the global variable one wont be good performance wise
How are you hitting the limit? If you don't use a variable often, for example if you have a number in a variable, and you don't use it often, you're better off using a number literal.
In all the Lua code I have seen no one has hit this limit. If you even get close to this amount you are doing something badly wrong.
Do note that using a well named variable instead of a number literal can help code clarity (and if it's used in more than one place, it keeps the code easy to change later).
@kingdom5, I believe it is the fact that I've dedicated all client side gui functionality to this one module script, which results in a large number of variables, especially if you have several guis.