Module:DungeonsDLC/sandbox

local p = {}

local i18n = { title = "This page describes content that is a part of the $2 DLC.", titleUpcoming = "This page describes content that is a part of an upcoming DLC.", titleSection = "This section describes content that is a part of the $2 DLC.", titleUpcomingSection = "This section describes content that is a part of an upcoming DLC.", message = "This feature may be added to the game in the future.", category = "", categoryFuture = "", }

function p.base( f ) local args = f	if f == mw.getCurrentFrame then args = require( 'Module:ProcessArgs' ).merge( true ) else f = mw.getCurrentFrame end local dataPage = mw.loadData( 'Module:DungeonsDLC/data' ) local data = dataPage[args[1]] or {} if not args.section then if args[1] then title = i18n.title:gsub( '%$1', args[1] ):gsub( '%$2', data.name or args[1] ) else title = i18n.titleUpcoming end else if args[1] then title = i18n.titleSection:gsub( '%$1', args[1] ):gsub( '%$2', data.name or args[1] ) else title = i18n.titleUpcomingSection end end if data.released == true then text = args.message or '' else text = args.message or i18n.message end if not args.nocat then if args[1] then if data.released == true then cat = i18n.category:gsub( '%$1', args[1] or '') else cat = i18n.category:gsub( '%$1', args[1] or '') .. i18n.categoryFuture end else cat = i18n.categoryFuture end end local msgbox = f:expandTemplate{ title = 'Message box', args = { title = title, text = text, image = data.image or "Mystery Armor (MCD).png", type = "edition", mini = args.section or '' } }

return msgbox, cat or '' end

function p.doc(f) local dataPage = mw.loadData( 'Module:DungeonsDLC/data' ) local valid_args = {} for dlc_name, val in pairs(dataPage) do		table.insert( valid_args, dlc_name ) end local rows = {} for i, val in pairs(valid_args) do table.insert( rows, f:preprocess(' ' .. valid_args[i] .. '   ') )	end return table.concat( rows) end

return p