loader.lua
author Kim Alvefur <zash@zash.se>
Fri, 17 Mar 2023 13:51:43 +0100
changeset 12951 14a44b1a51d0
child 12952 29983f09c913
permissions -rw-r--r--
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.

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