ok, it makes sense, thanks.
On Monday, December 12, 2016 at 7:33:49 PM UTC+8, Javier Guerra wrote:
On 12 December 2016 at 10:41, Itamar Gilad
<ita...@metapacket.com> wrote:
To avoid polluting the global namespace, I think it would be best to store it to a temporary variable that you discard ( local ignored = require("xxx") )
the one polluting the global namespace or not is the module itself, not how it's called.
IOW: the module can mess with the environment, either directly or by using the (deprecated) 'module()' function. if it does so, assigning to a local variable won't change that.
if it doesn't store anything on the global, then the only effect would be to return something, so you have to get that somewhere, typically on a local variable. if you don't, then it will be (almost) as if you hadn't require()'d it.
But since the original question stated that the return value wasn't needed, then it seems that the purpose of the module is to modify some part of the environment, not about the returned value; so doing the assignment or not wouldn't make any difference.
[*] "almost" because the require() function stores whatever the module returns in the 'packages.loaded' table.