lua-users home
lua-l archive

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


On Tue, Oct 18, 2011 at 6:20 PM, Sean Conner <sean@conman.org> wrote:
>
>  "But module() and require() could keep a private table with references to
> each module and not dump them into the global space," you say.  Okay, but
> you *still* need a global namespace, because DarkGod has *his* DNS module
> (named dns) and I have *my* DNS module (which would also be named "dns"), so
> which one is returned when you require("dns")?  (assuming that I have
> modules I wrote using my DNS module, and some other modules I want to use
> might be using DarkGod's DNS module)
>

Require already does this, and you need to separate them at the
filesystem level irregardless of what scope they're imported into.

local dns = require 'crazy.weird.dns'
local dns2 = require 'somebody.elses.dns'

None of this has anything to do with global scope or module.