let me suggest one further heresy… (again, this is just food for thought, without endorsing/disapproving of it)
let’s say you take your “framework” (aka “settings”) and decide to refer to it as “_F”. let’s further say that you eventually find that nearly every module everywhere ends up requiring it. that is, every module has a local “_F” defined in its environment.
-- everymodule.lua local \_F = require("framework")
so is there really any benefit to making “_F” local rather than global? remember, it’s YOUR environment to do with as you wish, and the name is already in use everywhere, so it’s not like you’d risk “clobbering” some other mystery global from an unknown source.
it turns out that there is in fact a small performance benefit to a local _F over a global _F, but it would be fair to ask if that difference is of any practical consequence for your particular use.
in other words, let’s say you allowed yourself the use of ONE global: _F. Q: Would the world come to an end??? A: probably not.
for example:
-- main.lua \_F = { modA = require("moduleA"), modB = require("moduleB"), --etc } -- moduleA function moduleA.test() \_F.modB.doSomething() end
Avoiding the careless use of globals is a Good Thing, and it is entirely possible (and not very difficult) to avoid them entirely, if you wish. But, religious zealotry aside, there really isn’t anything wrong with the considered use of globals.
[edit: code formatting got clobbered during post]