Anonymous

Module:Shared: Difference between revisions

From Melvor Idle
Implement printError()
(shallowClone: Implement)
(Implement printError())
Line 411: Line 411:
return p.formatnum(number)
return p.formatnum(number)
end
end
end
-- Applies formatting to an error message for display on wiki pages.
-- Also appends a category such that errors can be easily located
function p.printError(message)
-- Prevent message being interpreted as wikitext and handle non-string messages
local messageString = mw.text.nowiki(type(message) == 'string' and message or mw.dumpObject(message))
return '[[Category:Pages with script errors]]<div class="text-negative">ERROR: ' .. messageString .. '</div>'
end
end