Модуль:Entity Sprite/all: различия между версиями

Нет описания правки
Метка: отменено
Нет описания правки
Метка: отменено
Строка 210: Строка 210:


local function buildFileExistenceMap(data)
local function buildFileExistenceMap(data)
local titlesList = collectFileTitles(data)
local map = {}
 
if mw.title and mw.title.newBatch then
local titlesList = {}
 
for id, _ in pairs(data) do
table.insert(titlesList, "Файл:" .. prefix .. id .. ".png")
end
 
local titleObjs = mw.title.newBatch(titlesList)
:lookupExistence()
:getTitles()


local titleObjs = mw.title.newBatch(titlesList)
for _, title in ipairs(titleObjs) do
:lookupExistence()
if title and title.prefixedText then
:getTitles()
map[title.prefixedText] = title.exists and not title.isRedirect
end
end


local map = {}
return map
end
 
for id, _ in pairs(data) do
local name = "Файл:" .. prefix .. id .. ".png"
local title = mw.title.new(name)


for _, title in ipairs(titleObjs) do
if title then
if title and title.prefixedText then
map[name] = title.exists and not title.isRedirect
map[title.prefixedText] = title.exists and not title.isRedirect
else
map[name] = false
end
end
end
end