[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: A major problem with the Lua ecosystem
- From: Tim Hill <drtimhill@...>
- Date: Thu, 1 Feb 2018 12:34:43 -0800
> On Feb 1, 2018, at 8:41 AM, Sean Conner <firstname.lastname@example.org> wrote:
> It was thus said that the Great Dibyendu Majumdar once stated:
>> Sorry I should know the answer to this but I don't. Does Lua support dotted module names... i.e. map to directory path?
> You mean something like:
> net = require "org.conman.net" --?
> If so, then yes, Lua does.
This cleanly solves the external namespace, assuming someone can promote some form of standardization around whatever convention is agreed (LuaRocks team???). But it leaves open that global variable used for the assignment target. If I control the whole corpus of Lua code in a project, then I can control the internal global namespace, but if I’m using 3rd party Lua code which ITSELF using require(), how to I handle namespace collisions on these globals?
This would seem to recommend a coding style where a loadable Lua module use locals only for require():
local net = require(“org.timhill.network”)