Module:Module introspection: Difference between revisions

Ganaram inukshuk (talk | contribs)
mNo edit summary
Ganaram inukshuk (talk | contribs)
todo
Line 2: Line 2:
local getArgs = require("Module:Arguments").getArgs
local getArgs = require("Module:Arguments").getArgs
local p = {}
local p = {}
-- TODO: add additional functions:
-- - Determine whether a main function exists, as _main or a function of the
--  same name as the module with an underscore.
-- - Determine whether a wrapper exists, as main or a function of the same name
--  as the module, without an underscore.
-- - If the wrapper exists without _main, the wrapper is assumed to be the main
--  function.
-- - If both wrapper and _main exists, _main is the main function.
-- - If neither function exists, then the module is a metamodule, a module that
--  generally provides functionality to other modules.


-- Inspects a module for its functions, its dependencies, and the functions used
-- Inspects a module for its functions, its dependencies, and the functions used
Line 203: Line 214:
return func_lines
return func_lines
end
end
-- Helper function: determines whether module has a main function; if it does,
-- it indicates that it's not a library function and provides specific function-
-- ality, usually for a template.


-- Main function; to be called by wrapper
-- Main function; to be called by wrapper