[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Command line library load in Lua 5.2
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 2 Nov 2011 15:54:02 -0200
> On the contrary, my point is precisely that all the new good habits of
> avoiding pollution of the global namespace is undermined by the Lua5.2
> interpreter itself.
> The present behaviour is this:
> ~~~~ mymod.lua
> return 42
> $ lua5.1 -l mymod -e "print(mymod)"
> $ lua5.2 -l mymod -e "print(mymod)"
> I.e. the global name is not created by the module, but by the Lua5.2
> standalone interpreter.
Option '-l' would be essentially useless if it did not create the
global. It is intended to be used in interative mode and with the -e
$ lua5.2 -l mymod -e "print(mymod.foo(10))"
Not polluting the global namespace does not mean a complete prohibition
of ever creating a global.