Module:Module introspection: Difference between revisions
todo |
todo |
||
| Line 22: | Line 22: | ||
end | end | ||
]]-- | ]]-- | ||
-- PROPOSED ALGORITHM FOR FINDING FUNCTIONS OF DEPENDENCIES | |||
-- - Find every unique function call in the template, filtering out all function | |||
-- calls that do not correspond to a dependency. For a dependency included as | |||
-- local dep = require("Module:Dependency"), the module is called "Dependency" | |||
-- and is called "dep" throughout the code. Function calls involving this | |||
-- dependency will have "dep" as part of the name, as dep(), dep.func(), or | |||
-- with any number of dots (dep.utils.formatter.func()), but zero or one dots | |||
-- is typical. | |||
-- - For each dependency name, place each function call with that dependency's | |||
-- name in a table of function calls. | |||
-- - Inspect each dependency's table. If there is at least one function call in | |||
-- that table, then that dependency is used. If not, then that module is not | |||
-- used. | |||
-- - If function calls match the name of the dependency "dep", then either the | |||
-- module returned a function or the code require("Module:Dep").func selected | |||
-- only one function. If it's the former, then the module IS the function. If | |||
-- it's the latter, then func from require("Module:Dep").func is the function. | |||
-- In either case, if no function calls called "dep" are found, then the | |||
-- dependency "dep" was not used. | |||
-- Inspects a module for its functions, its dependencies, and the functions used | -- Inspects a module for its functions, its dependencies, and the functions used | ||