Module:Protection banner: Difference between revisions

allow passing the config object into the exportToLua and exportToWiki functions
Enwikipedia>Jackmcbarn
(get a few other changes from the ec)
Enwikipedia>Mr. Stradivarius
(allow passing the config object into the exportToLua and exportToWiki functions)
Line 10:
 
-- Lazily initialise modules and objects we don't always need.
local mArguments, mMessageBox, lang, config
 
--------------------------------------------------------------------------------
Line 933:
local ProtectionBanner = {}
 
function ProtectionBanner.exportToWiki(frame, configObj, titleObj)
mArguments = mArguments or require('Module:Arguments')
local args = mArguments.getArgs(frame)
return ProtectionBanner.exportToLua(args, configObj, titleObj)
end
 
function ProtectionBanner.exportToLua(args, configObj, titleObj)
config configObj = configObj or mw.loadData('Module:Protection banner/config')
titleObj = titleObj or mw.title.getCurrentTitle()
 
-- GetInitialise dataprotection and blurb objects
if not config then
config = mw.loadData('Module:Protection banner/config')
end
local configObj = config
local protectionObj = Protection:new(args, configObj, titleObj)
 
-- Initialise the blurb object
local blurbObj = Blurb:new(configObj, protectionObj, titleObj)
blurbObj:setDeletionDiscussionPage(args.xfd)