From 32445b308284f8475587aa12dd4778c3234aa31a Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 5 Mar 2023 14:07:08 +0100 Subject: 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. --- core/moduleapi.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core') diff --git a/core/moduleapi.lua b/core/moduleapi.lua index 5f9ee3c7..4afadfd7 100644 --- a/core/moduleapi.lua +++ b/core/moduleapi.lua @@ -169,6 +169,10 @@ function api:depends(name) 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 -- cgit v1.2.3