lua-users home
lua-l archive

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


On Tue, May 16, 2023 at 08:46:38AM -0300, Soni "They/Them" L. wrote:
> 
> 
> On 5/15/23 05:42, Scott Morgan wrote:
> > On 5/15/23 02:22, Soni "They/Them" L. wrote:
> > > 
> > > > Beyond that, just tweak the package.* items to suit your
> > > > particular requirements.
> > > 
> > > No, since that is not using the convention of treating the contents
> > > of foo.lua.d/ as subfiles of foo.lua.
> > > 
> > 
> > What convention? Who is using anything.lua.d?
> > 
> 
> Not anything.lua.d but /etc/profile.d/ and /etc/something.conf.d/ are fairly
> common.
> 
> > Why can't you change the package.* items in Lua to solve this yourself?
> > I'm pretty sure just changing package.path and package.cpath would do
> > it.
> 
> It wouldn't be enough. A searcher would work, tho. But that's beside the
> point.

If you are looking for run_parts, it is a simple matter to create:

fd = io.popen("ls /path/to/mods")
File = fd:read()
while File ~= nil do
  Mod = File:match("([^%/%.]+).lua$")
  if Mod ~= nil then require(Mod) end
  File = fd:read()
end