Module:Error: Difference between revisions
Content deleted Content added
simplify argument-grabbing code |
m 19 revisions imported: infobox |
||
(12 intermediate revisions by 3 users not shown) | |||
Line 2:
local p = {}
local function _error(args)
local tag = mw.ustring.lower(tostring(args.tag))
-- Work out what html tag we should use.
if not (tag == 'p' or tag == 'span' or tag == 'div') then
t = tag▼
else▼
end
-- Generate the html.
▲ return tostring(root)
end
function p.error(frame)
local
if type(frame.args) ==
-- We're being called via #invoke. The args are passed through to the module
-- from the template page, so use the args that were passed into the template.
else
-- We're being called from another module or from the debug console, so assume
-- the args are passed in directly.
end
-- if the message parameter is present but blank, change it to nil so that Lua will
if args.message == "" then
▲ -- to nil, so Lua will consider them false too.
end
return _error(args)
end
|