Module:Trivia

--[=[

Lua Module for Trivia Functions

--]=]

local p = {} local util = require("Module:Utility") local ECR = require("Module:ECR").getTrivia local collectionData = mw.loadData( 'Module:ItemCollection/data' )

function p.main(frame) local tArgs = util.getArgs(frame)

local pagename = mw.title.getCurrentTitle.prefixedText local height = 13 local tOut = "" if collectionData["Items"][pagename] and collectionData["Items"][pagename][2] then local itemType = collectionData["Items"][pagename][2] if itemType == "ba" then height = 27 elseif itemType == "bc" then height = 47 elseif itemType == "pf" or itemType == "d" then height = 40 elseif itemType == "ch" or itemType == "cos" then height = 15 end end for i, item in pairs(tArgs) do tOut = "* " .. item .. "\n" .. tOut end

if collectionData["Items"][pagename] and collectionData["Items"][pagename][2] == "ch" then local TC = require("Module:MiniEvent").getCharTC tOut = TC({}) .. tOut end

if pagename:match("^Category%:") and tArgs[1] then tOut = '* ' .. table.concat(tArgs, "\n* ") .. '\n' end

tOut = (tOut~="" and '|-|Other Trivia=\n \n' .. tOut .. ' \n' or "")

return tOut .. ECR(pagename, height) end

return p