Module:User:NickTheRed37/RandomFact

-- Random facts module -- Created by Naista2002 on September 24-25, 2014 -- For use with the template User:Naista2002/Template/RandomFact.

local p = {}

function p.randfact(f) -- Arguments local args = f:getParent.args -- Quotes local quotes = {} -- Initial text local starttext = "" -- Seed the random number generator math.randomseed(os.time) for i, v in ipairs(args) do       if i == 1 then starttext = v           if starttext:sub(-1) == "\n" then starttext = starttext:sub(1, starttext:len-1) end else table.insert(quotes, v)       end end local id = math.random(#quotes) mw.log("ID: " .. id) mw.log("Selected: " .. quotes[id]) return starttext .. "... ..." .. quotes[id] end

return p