Anonymous
×
Create a new article
Write your page title here:
We currently have 924 articles on WIKI - Flat MMO. Type your article name above or click on one of the titles below and start writing!



WIKI - Flat MMO
924Articles

Module:RandomText: Difference between revisions

Created page with "inspect = require("Module:InspectLua") local p = {} function p.pp(text) return mw.getCurrentFrame():preprocess(text) end function p.randomizeText (frame) local args = frame:getParent().args local textArray = {} local allText = args[1] for word in string.gmatch(allText, '[^\r\n]+') do table.insert(textArray, word) end math.randomseed(os.time()) local randomIndex = math.random(table.getn(textArray)) return p.pp(textArray[randomIndex]) end return p"
 
No edit summary
 
Line 1: Line 1:
inspect = require("Module:InspectLua")
local p = {}
local p = {}



Latest revision as of 06:39, 29 July 2025

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