打开/关闭搜索
搜索
打开/关闭菜单
331
1.7K
131
11.8K
星露谷物语扩展百科
导航
首页
最近更改
随机页面
交流群
互通站
上传文件
打开/关闭外观设置菜单
通知
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。
user-interface-preferences
个人工具
创建账号
登录
查看“︁模块:Utils”︁的源代码
来自星露谷物语扩展百科
查看
阅读
查看源代码
查看历史
associated-pages
模块
讨论
更多操作
←
模块:Utils
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:已验证邮箱用户
您必须确认您的电子邮件地址才能编辑页面。请通过
参数设置
设置并确认您的电子邮件地址。
您可以查看和复制此页面的源代码。
local arguments = require("Module:Arguments") ---@diagnostic disable-next-line: undefined-global local mw = mw local p = {} function p.getArg(input, index) if not index then index = 1 end if type(input) == "string" then return input end local result = input[index] or (input.args and input.args[index]) or input:getParent().args[index] or "" return result end -- Normalizes various invocation styles (frame, table, single value) into an args table. function p.resolveArgs(input, options) if type(input) == "table" then if type(input.getParent) == "function" then return arguments.getArgs(input, options) end if type(input.args) == "table" then return input.args end return input end return {input} end function p.hasChinese(str) return type(str) == 'string' and string.match(str, "[\228-\233][\128-\191][\128-\191]") ~= nil end function p.LazyLoad(moduleName, toLowerCase) toLowerCase = toLowerCase or false local loaded = nil local function doLoad() if loaded == nil then loaded = mw.loadData(moduleName) if toLowerCase then local lowerCaseLoaded = {} for key, value in pairs(loaded) do lowerCaseLoaded[string.lower(key)] = value end loaded = lowerCaseLoaded end end return loaded end local meta = {} meta.__index = function(_table, key) return doLoad()[key] end meta.__pairs = function(_table) return pairs(doLoad()) end meta.__ipairs = function(_table) return ipairs(doLoad()) end local ret = {} setmetatable(ret, meta) return ret end function p.ExpandTemplate(title, args) return mw.getCurrentFrame():expandTemplate{title = title, args = args} end function p.fileExists(filename) local url = mw.getCurrentFrame():callParserFunction('filepath', filename) return url ~= '' end function p.normalizeKey(text) if not text then return nil end return text:lower():gsub("_", " ") end function p.deepCopy(original) local copy = {} for key, value in pairs(original) do if type(value) == "table" then copy[key] = p.deepCopy(value) else copy[key] = value end end return copy end function p.tableContains(tbl, element) if type(tbl) ~= "table" then return false end for _, value in ipairs(tbl) do if value == element then return true end end return false end function p.uniqueValues(sequence) if type(sequence) ~= "table" then return {} end local ordered, seen = {}, {} for _, value in ipairs(sequence) do if not seen[value] then seen[value] = true table.insert(ordered, value) end end return ordered end function p.tablesEqual(t1, t2) if t1 == t2 then return true end if type(t1) ~= "table" or type(t2) ~= "table" then return false end for _, value in pairs(t1) do if not p.tableContains(t2, value) then return false end end for _, value in pairs(t2) do if not p.tableContains(t1, value) then return false end end return true end function p.tablesOverlap(t1, t2) if t1 == t2 then return true end if type(t1) ~= "table" or type(t2) ~= "table" then return false end for _, value in pairs(t1) do if p.tableContains(t2, value) then return true end end for _, value in pairs(t2) do if p.tableContains(t1, value) then return true end end return false end function p.stringContains(text, substring) if type(text) ~= "string" or type(substring) ~= "string" then return false end return string.find(text, substring, 1, true) ~= nil end p.lazyload = p.LazyLoad p.lazyLoad = p.LazyLoad p.expandTemplate = p.ExpandTemplate return p
该页面嵌入的页面:
模块:Documentation
(
查看源代码
)
模块:Documentation/styles.css
(
查看源代码
)
模块:ProcessArgs
(
查看源代码
)
模块:STConversion
(
查看源代码
)
模块:Static
(
查看源代码
)
模块:TSLoader
(
查看源代码
)
模块:Utils/doc
(
查看源代码
)
返回
模块:Utils
。
查看“︁模块:Utils”︁的源代码
来自星露谷物语扩展百科