全站通知:

模块:Description

来自星露谷物语维基
跳到导航 跳到搜索

本模块用于模板:Description,替代了曾用的 #switch 写法,提高了运行的效率。

大部分数据均由游戏中导出,如需手动添加,请补至页面模块:Description/data/overrides的末尾。

[ 查看 | 编辑 | 历史 | 刷新 ]上述文档的内容来自模块:Description/doc
local utils = require("Module:Utils")

local data = utils.LazyLoad("Module:Description/data/en", true)
local data2 = utils.LazyLoad("Module:Description/data/zh", true)
local data3 = utils.LazyLoad("Module:Description/data/id", true)
local overrides = utils.LazyLoad("Module:Description/data/overrides", true)

local p = {}

function p.getDesc(input)
    local text = utils.getArg(input)
    if not text then
        return ""
    end
    local lowerText = string.lower(text)
    
    return overrides[lowerText] or data[lowerText] or data2[lowerText] or data3[lowerText] or "" 
end

p.description = p.getDesc

return p