lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On Feb 29, 2008, at 12:51 AM, Ben wrote:

On Thu, Feb 28, 2008 at 11:35 AM, Petite Abeille
<petite.abeille@gmail.com> wrote:
That said, I personally tend to only deal with modules that return a
table and don't pollute the global namespace recklessly. If they
behave differently, they better need a good reason and/or add quiet a
bit of value (e.g. Niklas' markdown.lua).

If one uses the `module` function, it puts an entry in the global
namespace anyway, correct?  It's just if you do a `local math =
require "math"`, the `math` name resolves to the local entry first.
At least, that's my understanding.  (Also, if this behavior didn't
happen, it would make it would make `require "foo"` useless.)

Some have argued against it:

http://lua-users.org/wiki/LuaModuleFunctionCritiqued

In any case... if one never use _G... it could as well not be there :)

Cheers,

PA.