模組:首页2/sandbox
外观
这是Module:首页2(差异)的沙盒。 |
local z = {}
local r = require('Module:Random')
function getItems( frame )
local page = mw.title.new( frame.args.title ):getContent()
local matches = {}
local black = {}
if frame.args.black then
for b in mw.text.gsplit( frame.args.black, '|', true ) do
black[b] = true
end
end
for m in mw.ustring.gmatch ( page, '%[%[(.-)%]%]' ) do
if not black[m] then
table.insert ( matches, m )
end
end
return matches
end
function z.count( frame )
return #getItems( frame )
end
function z.list( frame )
local d = getItems( frame )
l = r.randomizeArray(d, 3)
x = table.concat(l, ",")
return x
end
return z