Documentation for this module may be created at Module:RandomText/doc
1 local p = {}
2
3 function p.pp(text)
4 return mw.getCurrentFrame():preprocess(text)
5 end
6
7 function p.randomizeText (frame)
8 local args = frame:getParent().args
9 local textArray = {}
10 local allText = args[1]
11 for word in string.gmatch(allText, '[^\r\n]+') do
12 table.insert(textArray, word)
13 end
14
15 math.randomseed(os.time())
16 local randomIndex = math.random(table.getn(textArray))
17 return p.pp(textArray[randomIndex])
18 end
19
20 return p
