跳转到内容

模組:Rand

维基百科,自由的百科全书

这是本页的一个历史版本,由Vanished user 1929210留言 | 贡献2016年9月13日 (二) 16:47 (// Edit via Wikiplus)编辑。这可能和当前版本存在着巨大的差异。

local func = {}

function func.randitem( frame )
    local text = frame.args[1]
    local list = mw.text.split(text, '[\n\r]%s*%*%s*')
    local n = #list - 1
    
    math.randomseed(os.time())
    local r = math.random(n) + 1
    
    return list[r]
end

return func