Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
12920:cdb996637b08 | 12921:d238633a9d67 |
---|---|
167 if not mod then | 167 if not mod then |
168 return error(("Unable to load required module, mod_%s: %s"):format(name, ((err or "unknown error"):gsub("%-", " ")) )); | 168 return error(("Unable to load required module, mod_%s: %s"):format(name, ((err or "unknown error"):gsub("%-", " ")) )); |
169 end | 169 end |
170 end | 170 end |
171 self.dependencies[name] = true; | 171 self.dependencies[name] = true; |
172 if not mod.module.reverse_dependencies then | |
173 mod.module.reverse_dependencies = {}; | |
174 end | |
175 mod.module.reverse_dependencies[self.name] = true; | |
172 return mod; | 176 return mod; |
173 end | 177 end |
174 | 178 |
175 local function get_shared_table_from_path(module, tables, path) | 179 local function get_shared_table_from_path(module, tables, path) |
176 if path:sub(1,1) ~= "/" then -- Prepend default components | 180 if path:sub(1,1) ~= "/" then -- Prepend default components |