Module:Trivia

--[=[

Lua Module for Trivia Functions

--]=]

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

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

local pagename = mw.title.getCurrentTitle.text local height = 15 local tOut = "" if collectionData["Items"][pagename] and collectionData["Items"][pagename][2] then if collectionData["Items"][pagename][2] == "ba" then height = 20 elseif collectionData["Items"][pagename][2] == "bc" then height = 40 elseif collectionData["Items"][pagename][2] == "d" then height = 35 elseif collectionData["Items"][pagename][2] == "pf" then height = 27 end end for i, item in pairs(tArgs) do tOut = "* " .. item .. "\n" .. tOut end return '\n' .. tOut .. " " end

function p.infobox(frame) local tArgs = util.getArgs(frame) local tIndex = {} local tOut = {} local space = "" local i = 0 for k in mw.text.gsplit(tArgs[1], ', ') do		table.insert(tIndex, k)	end

table.sort(tIndex)

for _, item in ipairs(tIndex) do table.insert(tOut, space .. item) space = " " i = i + 1 end if i >= 5 then return ' ' .. table.concat(tOut) .. " "	else return table.concat(tOut) end end

return p