Module:Moelib
跳到导航
跳到搜索
_G.moe = {} -- 定义为全局变量
_G.toboolean = function(value)
if value == nil then return false
elseif value == 0 then return false
elseif value == "false" then return false
else return true
end
end
function _G.moe.import(p)
if type(p) ~= "string" then
p = mw.text.trim(p, "[%s%./\\]")
if p ~= "" then
local path = mw.text.split(p, "[%./\\]")
if path[1] == "moe" then
path[1] = "moelib"
else
table.insert(path, "moelib")
end
if #path >= 2 then
local title = mw.title.new("模块", table.concat(path, "/"))
if title.exists then
_G.moe[path[2]].require(tostring(title))
end
end
end
end
end