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

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


-- Генерация текста для элемента JSON
-- Генерация текста для элемента JSON
local function generateTemplate(entry, param, secondaryParam)
local function generateTemplate(entry, param, secondaryParam, data)
     local spritePath = entry.Sprite and entry.Sprite.sprite or (entry.Icon and entry.Icon.sprite)
     local spritePath = entry.Sprite and entry.Sprite.sprite or (entry.Icon and entry.Icon.sprite)
     if not entry.id or not spritePath then
     if not entry.id or not spritePath then
Строка 88: Строка 88:
     elseif param == "path" then
     elseif param == "path" then
         if secondaryParam then
         if secondaryParam then
             if spritePath == secondaryParam then
             for _, entry in ipairs(data) do
                return entry.id
                local spritePath = entry.Sprite and entry.Sprite.sprite or (entry.Icon and entry.Icon.sprite)
                if spritePath == secondaryParam then
                    return entry.id  
                end
             end
             end
             return nil
             return nil