Модуль:Песочница/Pok: различия между версиями

мНет описания правки
мНет описания правки
Строка 8: Строка 8:
         return "Ошибка: не указан обязательный параметр id."
         return "Ошибка: не указан обязательный параметр id."
     end
     end
    local itemStack = frame:preprocess(string.format('{{#invoke:Prototypes/Хранилище/Предмет|main|framing|stack|%s}}', id))
    local itemContained = frame:preprocess(string.format('{{#invoke:Prototypes/Хранилище/Предмет|main|framing|contained|%s}}', id))
    local itemSlot = frame:preprocess(string.format('{{#invoke:Prototypes/Хранилище/Предмет|main|framing|slot|%s}}', id))
    local itemChem = frame:preprocess(string.format('{{СollapsibleMenu|color=#3e7c82|{{#invoke:Prototypes/Хранилище/Предмет|main|chem|%s}}}}', id))
      
      
     local itemName = frame:preprocess("{{#invoke:Entity Lookup|getname|" .. id .. "}}")
     local itemName = frame:preprocess("{{#invoke:Entity Lookup|getname|" .. id .. "}}")


     local prefix = args[2] or ""
     local prefix = args[2] or ""
 
     local label = args["label"]
     local label = args["label"] or itemName
    if label == nil then
        label = itemName
    end


     local image
     local image
Строка 29: Строка 36:
             linkTarget = itemName
             linkTarget = itemName
         end
         end
         labelOutput = string.format("[[%s|%s]]", linkTarget, label)
         if label ~= "" then
            labelOutput = string.format("[[%s|%s]]", linkTarget, label)
        else
            labelOutput = ""
        end
    end
 
    local result = image .. " "
    if args["repository"] then
        result = result .. itemStack .. " " .. labelOutput .. " " .. itemContained .. " " .. itemSlot .. " " .. itemChem
    else
        result = result .. prefix .. " " .. labelOutput
     end
     end


     local result = image .. " " .. prefix .. " " .. labelOutput
     return frame:preprocess("<span>" .. result .. "</span>")
    return frame:preprocess(result)
end
end


return p
return p