Module:Module introspection: Difference between revisions
more bugfix |
bugfix main function detection |
||
| Line 142: | Line 142: | ||
-- Main function; to be called by wrapper | -- Main function; to be called by wrapper | ||
function p._module_introspection(args) | function p._module_introspection(args) | ||
local module_name = args["module_name"] | local module_name = args["module_name" ] | ||
local main_function = args[" | local main_function = args["main_function"] | ||
-- Get module functions | -- Get module functions | ||
| Line 227: | Line 227: | ||
-- Normalize module name so it can be used to find the main function, which | -- Normalize module name so it can be used to find the main function, which | ||
-- is assumed to be the same name as the module. | -- is assumed to be the same name as the module. Module assumes snake_case | ||
local | -- is used for function names. (If this fails, it can be entered manually.) | ||
local normalized_name = module_name:gsub("[^%w]", "_") | |||
local main_function = args["main_function"] or "_" .. normalized_name -- snake_case assumed | |||
-- Call the introspection function | -- Call the introspection function | ||
local dep_table, func_table = p._module_introspection({ | local dep_table, func_table = p._module_introspection({ | ||
["module_name"] = module_name | ["module_name"] = module_name, | ||
["main_function"] = main_function, | ["main_function"] = main_function, | ||
}) | }) | ||