维护提醒

BWIKI 全站将于 9 月 3 日(全天)进行维护,期间无法编辑任何页面或发布新的评论。

全站通知:

模块:Description

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

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

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

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

local Data = Helper.LazyLoad("Module:Description/data/en", true)
local Data2 = Helper.LazyLoad("Module:Description/data/zh", true)
local Data3 = Helper.LazyLoad("Module:Description/data/id", true)
local SVE = Helper.LazyLoad("Module:Description/data/expanded/en", true)
local SVE2 = Helper.LazyLoad("Module:Description/data/expanded/zh", true)
local Special = Helper.LazyLoad("Module:Description/data/overrides", true)

local p = {}

function p.description(frame)
    local text = frame.args[1]
    if not text then
        return ""
    end
    local lowerText = string.lower(text)
    
    return Special[lowerText] or Data[lowerText] or Data2[lowerText] or Data3[lowerText] or "" 
end

function p.descriptionSVE(frame)
    local text = frame.args[1]
    if not text then
        return ""
    end
    local lowerText = string.lower(text):gsub("_"," ")
    
    return SVE[lowerText] or SVE2[lowerText] or Special[lowerText] or Data[lowerText] or Data2[lowerText] or Data3[lowerText] or "" 
end

return p