[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A guide to building Lua modules
- From: Kevin Martin <kev82@...>
- Date: Mon, 14 Apr 2014 23:20:56 +0100
On 14 Apr 2014, at 19:53, Enrique Garcia Cota <kikito@gmail.com> wrote:
> If I understand you correctly, you are basically describing a system where `require` doesn't work.
No, require works fine - it's just that the searchers for package.path, and package.cpath have been removed, and our own DB searcher added. See the Lua documentation of the package library.
> I understand where you are coming from, but also be aware that there's a blurry line there - if you take enough features from Lua, is it still the same language?
I must apologise, I was reading your document on the bus this morning and didn't look in great enough detail. I just saw your use of the phrase 'current_folder', and assumed you were assuming a filesystem without looking at your actual code example.
If the main file (e.g. your init.lua) of a multi file module did anything even remotely close to
do
local function requiresubmod(n)
return require(string.format([[%s-%s]], (…), n))
end
local part1 = requiresubmod("part1")
…
…
end
Then it would automatically work with our DB system. My issue is with multi file modules that don't use require, but do something with loadfile/dofile instead.
I still think a word of warning in your document to remind people that not everyone loads modules from the filesystem would be good, and perhaps get away from terminology like 'current_folder' as that is what led me the think you were doing the same.
Thanks,
Kevin