Diff

core/moduleapi.lua @ 12921:d238633a9d67

core.moduleapi: Record reverse dependencies Useful to know why a module was auto-loaded without having to dig trough all other modules for the one that depends on it.
author Kim Alvefur <zash@zash.se>
date Sun, 05 Mar 2023 14:07:08 +0100
parent 12874:b9468c8ac1d3
child 12972:ead41e25ebc0
line wrap: on
line diff
--- a/core/moduleapi.lua	Sat Mar 04 18:40:43 2023 +0100
+++ b/core/moduleapi.lua	Sun Mar 05 14:07:08 2023 +0100
@@ -169,6 +169,10 @@
 		end
 	end
 	self.dependencies[name] = true;
+	if not mod.module.reverse_dependencies then
+		mod.module.reverse_dependencies = {};
+	end
+	mod.module.reverse_dependencies[self.name] = true;
 	return mod;
 end