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

模块:GetRank:修订间差异

来自此界与彼端
无编辑摘要
无编辑摘要
 
(未显示同一用户的3个中间版本)
第3行: 第3行:
local p = {}
local p = {}


function p.exec(str)
function p.exec(title, rate)
mw.log(str)  
local num = tonumber(rate)
return '<div>'..str..'</div>'
local rateStr = ''
if num == nil then
rateStr = ''
else
rateStr = math.floor(num * 10 + 0.5) / 10
end
return '<div class="rank-row">'
..'<div class="rank-row-left">[['..title..']]</div>'
..'<div class="rank-row-right">'..rateStr..'</div>'
..'</div>'
end
end


function p.getRank(frame)
function p.getRank(frame)
local args = getArgs(frame)
local args = getArgs(frame)
return p.exec(args[1])
return p.exec(args[1], args[2])
end
end


return p
return p

2025年4月1日 (二) 21:53的最新版本

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

local getArgs = require('Module:Arguments').getArgs

local p = {}

function p.exec(title, rate)
	local num = tonumber(rate)
	local rateStr = ''
	if num == nil then
		rateStr = ''
	else
		rateStr = math.floor(num * 10 + 0.5) / 10
	end
	return '<div class="rank-row">'
	..'<div class="rank-row-left">[['..title..']]</div>'
	..'<div class="rank-row-right">'..rateStr..'</div>'
	..'</div>'
end

function p.getRank(frame)
	local args = getArgs(frame)
	return p.exec(args[1], args[2])
end

return p