Module:BaseModule/doc

This module is used as the base for other modules.

Usage
Calling  sets up a module to inherit all functionality.

Methods

 * - Creates a wrapper function for  and passes   to Module:Arguments
 * - Loads module data or a specific item from the data. The data is cached for future use.
 * - Check if  exists in.

Basic Example
local mw = mw

local string = string local sprintf = string.format

-- ----- MODULE FUNCTIONS --- -- local p = require("Module:BaseModule"):newModule local module_data = p:getModuleData("Module:Test/data")

local main_args = { parentFirst = true, wrappers = { "Template/Nothing" } }

p.main = p:makeInvokeFunc("_main", main_args)

-- -- PAGE FUNCTIONS -- function p._main(args, frame) --luacheck: ignore local text = mw.html.create("div")

for k, v in pairs(module_data) do       if p:pageExists(k) then k = sprintf("%s", k)       end

text :wikitext(sprintf("%s is %s ", k, v)) end

return tostring(text:allDone) end

return p