模块:Qualityprice:修订间差异
来自星露谷物语扩展百科
更多操作
删除的内容 添加的内容
created |
无编辑摘要 |
||
| (未显示同一用户的22个中间版本) | |||
| 第1行: | 第1行: | ||
local cache = require "mw.ext.LuaCache" |
|||
local KEY_PREFIX = "Module:Qualityprice" |
|||
local EXP_TIME = 172800 |
|||
local p = {} |
local p = {} |
||
local function expandTemplate(args) |
local function expandTemplate(args) |
||
local templateArgs = {} |
|||
for key, value in pairs(args) do |
|||
if value ~= "" then |
|||
templateArgs[key] = value |
|||
| ⚫ | |||
end |
|||
return mw.getCurrentFrame():expandTemplate{ |
return mw.getCurrentFrame():expandTemplate{ |
||
title = 'Qualityprice/Base', |
title = '模板:Qualityprice/Base', |
||
args = { |
args = { |
||
templateArgs[1], |
|||
templateArgs[2], |
|||
pm = |
pm = templateArgs['pm'], |
||
dsv = |
dsv = templateArgs['dsv'], |
||
hide = |
hide = templateArgs['hide'], |
||
quality = |
quality = templateArgs['quality'], |
||
} |
} |
||
} |
} |
||
| 第20行: | 第23行: | ||
function p.render(frame) |
function p.render(frame) |
||
local args = frame.args |
local args = frame.args |
||
args[1] = args[1]:gsub(".png", "") |
|||
local cacheKey = KEY_PREFIX .. "|" .. args[1] .. "|" .. args[2] .. "|" .. (args['pm'] or "") .. "|" .. (args['dsv'] or "").. "|" .. (args['hide'] or "").. "|" .. (args['quality'] or "") |
|||
if cache.get(cacheKey) then |
|||
local result = cache.get(cacheKey) |
|||
return result |
|||
| ⚫ | |||
local result = expandTemplate(args) |
local result = expandTemplate(args) |
||
cache.set(cacheKey, result, EXP_TIME) |
|||
return result |
return result |
||
end |
end |
||
2026年1月12日 (一) 21:00的最新版本
local p = {}
local function expandTemplate(args)
local templateArgs = {}
for key, value in pairs(args) do
if value ~= "" then
templateArgs[key] = value
end
end
return mw.getCurrentFrame():expandTemplate{
title = '模板:Qualityprice/Base',
args = {
templateArgs[1],
templateArgs[2],
pm = templateArgs['pm'],
dsv = templateArgs['dsv'],
hide = templateArgs['hide'],
quality = templateArgs['quality'],
}
}
end
function p.render(frame)
local args = frame.args
args[1] = args[1]:gsub(".png", "")
local result = expandTemplate(args)
return result
end
return p