Модуль:Prototypes/Механика/Исследование: различия между версиями

мНет описания правки
мНет описания правки
Строка 83: Строка 83:
local icon = frame.args.icon or ""
local icon = frame.args.icon or ""


-- Получение кастомных рецептов
-- Получение кастомных рецептов с индексами (если они есть)
local customRecipeUnlocks = {}
local customRecipeUnlocks = {}
for i = 1, 10 do  -- Проверяем до 10 индексов
local indexKey = "customRecipeUnlocksIndex" .. i
if frame.args[indexKey] then
table.insert(customRecipeUnlocks, frame.args[indexKey])
end
end
-- Получение кастомных рецептов без индексации
if frame.args.customRecipeUnlocks then
if frame.args.customRecipeUnlocks then
-- Разделяем на несколько значений, если они переданы через пробел
-- Разделяем на несколько значений, если они переданы через пробел
customRecipeUnlocks = mw.text.split(frame.args.customRecipeUnlocks, " ")
local tempUnlocks = mw.text.split(frame.args.customRecipeUnlocks, " ")
for _, item in ipairs(tempUnlocks) do
table.insert(customRecipeUnlocks, item)
end
end
end