lua doesn’t create a new instance of your code each time you require() it. require() is like “load if you haven’t yet”.
the variable that you’re referring to your code is local to this scene, but not the code itself.
if you’re thinking in OOP terms, then if you modify a *class* then yes, wherever you load that class will retain the changes.
what you may be intending to do is have your class return instances - then modify the instances for local use.
for instance (pun intended :D):
-- myClass will be local, but the code it references may already have been loaded/modified elsewhere -- in general you probably DON'T want to be modifying \*classes\* at runtime -- else no-one "else" (ie your code elsewhere) might know what to expect from it local myClass = require("MyClass") -- myInstance will be a brand new local copy of the base class -- go ahead and modify instances at runtime local myInstance = myClass.new(..whatever..)