模組:KillRSP/GUlist
外观
local p = {}
function p.getGUListData(frame)
local res = {
absolute = {},
suspected = {}
}
local success, data = pcall(mw.loadData, 'Module:RSP/GUlist')
if success and type(data) == 'table' then
for _, entry in pairs(data) do
if type(entry) == 'table' then
-- 处理域名
if type(entry.domains) == 'table' then
for _, d in ipairs(entry.domains) do
if type(d) == 'string' and d ~= "" then
table.insert(res.absolute, { d = d, src = 'gu' })
end
end
end
-- 处理名称
if entry.name and entry.name ~= "" then
table.insert(res.suspected, { d = entry.name, src = 'gu' })
end
end
end
end
if frame == mw.getCurrentFrame() then
return mw.text.jsonEncode(res)
else
return res
end
end
return p