Module:Wiki Poll

-- Since the old Wiki Polls system was removed on UCP wikis, I have a new Discussions based polls system installed on the wiki. -- We will now use this new version. local WikiMediaDataModule = {}

-- local Polls = { "4400000000000269311",	"4400000000000277127",	"4400000000000277128",	"4400000000000277129",	"4400000000000277283",	"4400000000000277312",	"4400000000000277313" }

-- Polls Section -- math.randomseed(os.time) -- Choose random seed. local AmountOfPolls = #Polls --Change this to account for additional polls being added, to have them all. local CurrentPoll = math.random(1, AmountOfPolls) --This changes randomly and is based on the AmountOfPolls variable.

function WikiMediaDataModule.GetAmountOfPolls return AmountOfPolls end

function WikiMediaDataModule.GetCurrentPollNumber return CurrentPoll end

function WikiMediaDataModule.GetCurrentPoll(frame) return frame:preprocess("") end

function WikiMediaDataModule.GetSpecificPoll(frame) local selectedPoll = frame.args[1] -- Error checking if math.floor(selectedPoll) ~= selectedPoll then error("Invalid input: Poll number is not an integer (" .. selectedPoll .. ")", 2)	end -- Error checking if math.floor(selectedPoll) ~= selectedPoll then error("Invalid input: Poll number is out of range of 1 to " .. AmountOfPolls .. " (" .. selectedPoll .. ")", 2)	end -- Return the poll return frame:preprocess("") end

function WikiMediaDataModule.GetAllPolls(frame) local stringToReturn = "" for pollNumber = AmountOfPolls, 1, -1 do       stringToReturn = stringToReturn.."===Poll "..pollNumber.."===\n\n" end return frame:preprocess(stringToReturn) end

function WikiMediaDataModule.GetAllPollsRaw(frame) local stringToReturn = "" for pollNumber = AmountOfPolls, 1, -1 do       stringToReturn = stringToReturn.."\n" end return frame:preprocess(stringToReturn) end

return WikiMediaDataModule