File

loader.lua @ 12947:14a44b1a51d0

prosody.loader: Allow loading modules under 'prosody' namespace (#1223) Actually `hg mv`-ing all the files is disruptive, basically breaking everything from rebasing all my WIP draft commits to the package building. So instead, what if we didn't and instead rewrote package names as they are `require()`-d? Debian packages produced by the Prosody are already installed into this structure so much will Just Work if all require calls are updated.
author Kim Alvefur <zash@zash.se>
date Fri, 17 Mar 2023 13:51:43 +0100
child 12948:29983f09c913
line wrap: on
line source

for i = #package.searchers, 1, -1 do
	local search = package.searchers[i];
	table.insert(package.searchers, i, function(module_name)
		local lib = module_name:match("^prosody%.(.*)$");
		if lib then
			return search(lib);
		end
	end)
end