打开/关闭菜单
切换首选项菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

模块:GetMottos:修订间差异

来自此界与彼端
创建页面,内容为“local getArgs = require('Module:Arguments').getArgs local mottos = require('Module:GlobalVars').mottos local stringUtil = require('Module:StringUtil') local p = {} function p.exec() local index = math.random(#mottos) return stringUtil.split(mottos[index], '@') end function p.getGenres(frame) -- local args = getArgs(frame) return p.exec() end return p”
 
撤销AkiraZea讨论)的修订版本1130
标签撤销
 
(未显示同一用户的12个中间版本)
第2行: 第2行:
local mottos = require('Module:GlobalVars').mottos
local mottos = require('Module:GlobalVars').mottos
local stringUtil = require('Module:StringUtil')
local stringUtil = require('Module:StringUtil')
local rand = require('Module:RandomUtil').random
local function randnum(min,max)
local frame = {
args = {}
}
frame.args[1] = min
frame.args[2] = max
return rand(frame)
end


local p = {}
local p = {}


function p.exec()
function p.exec()
local index = math.random(#mottos)
local index = randnum(1, #mottos)
return stringUtil.split(mottos[index], '@')
return stringUtil.split(mottos[index], '@')
end
end


function p.getGenres(frame)
function p.getMottos(frame)
local t = p.exec()
-- local args = getArgs(frame)
-- local args = getArgs(frame)
return p.exec()
return '<div class="home-quote"><div class="quote-content">'
..t[1]
..'</div>'
..'<div class="quote-author">——'
..t[2]
..'</div></div>'
end
end


return p
return p

2025年4月1日 (二) 16:58的最新版本

此模块的文档可以在模块:GetMottos/doc创建

local getArgs = require('Module:Arguments').getArgs
local mottos = require('Module:GlobalVars').mottos
local stringUtil = require('Module:StringUtil')
local rand = require('Module:RandomUtil').random

local function randnum(min,max)
	local frame = {
		args = {}
	}
	frame.args[1] = min
	frame.args[2] = max
	return rand(frame)
end

local p = {}

function p.exec()
	local index = randnum(1, #mottos)
	return stringUtil.split(mottos[index], '@')
end

function p.getMottos(frame)
	local t = p.exec()
	-- local args = getArgs(frame)
	return '<div class="home-quote"><div class="quote-content">'
		..t[1]
		..'</div>'
		..'<div class="quote-author">——'
		..t[2]
		..'</div></div>'
end

return p