Модуль:Entity Sprite/all: различия между версиями
Pok (обсуждение | вклад) Нет описания правки Метка: отменено |
Pok (обсуждение | вклад) Нет описания правки Метка: отменено |
||
| Строка 210: | Строка 210: | ||
local function buildFileExistenceMap(data) | local function buildFileExistenceMap(data) | ||
local titlesList = | 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() | |||
for _, title in ipairs(titleObjs) do | |||
if title and title.prefixedText then | |||
map[title.prefixedText] = title.exists and not title.isRedirect | |||
end | |||
end | |||
local | return map | ||
end | |||
for id, _ in pairs(data) do | |||
local name = "Файл:" .. prefix .. id .. ".png" | |||
local title = mw.title.new(name) | |||
if title then | |||
if title | map[name] = title.exists and not title.isRedirect | ||
map[ | else | ||
map[name] = false | |||
end | end | ||
end | end | ||