Module:Error

--- -- --                              Module:Error -- -- This module implements Template:Error ---

local cfg = {}

cfg.i18n = {}

cfg.i18n.errors = { no_message = 'No message specified.', }

cfg.tag = 'strong'

-- -- Main function --

local function _main(args) args.message = args.message or args[1] if not args.message or args.message == '' then error(cfg.i18n.errors.no_message, 2) end local html = mw.html.create(cfg.tag) :addClass('error') :wikitext(tostring(args.message)) return tostring(html) end

-- -- Exported functions --

local p = {}

function p.main(frame) local args if type(frame.args) == 'table' then -- Called via #invoke, so use the args that were passed into the -- template. args = frame.args else -- Called from another module or from the debug console, so assume args -- are passed in directly. args = frame end return _main(args) end

p.error = p.main

return p