Module:User:NickTheRed37/RandomFact

-- Random facts module -- Created by Naista2002 in 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 -- Random selector -- WARNING: Make sure to purge the page where the template is used in order to display different facts!!! local id = math.random(#quotes) return starttext .. "... ..." .. quotes[id] end

return p