On Feb 1, 2018, at 8:41 AM, Sean Conner <sean@conman.org> wrote:
It was thus said that the Great Dibyendu Majumdar once stated:
Hi
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.
-spc
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”)
…
—Tim