Module:Error: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
simplify code some more and trim whitespace from the message
actually, don't trim whitespace, as the original template doesn't do this
Line 7: Line 7:
local function _error(args)
local function _error(args)
local message = args.message or args[1] or error('no message specified', 2)
local message = args.message or args[1] or error('no message specified', 2)
message = mw.ustring.match(tostring(message), '^%s*(.*%S)') or '' -- Convert message to string and trim whitespace.
message = tostring(message)
local tag = mw.ustring.lower(tostring(args.tag))
local tag = mw.ustring.lower(tostring(args.tag))