Модуль:Sandbox: различия между версиями
Нет описания правки |
CatBG (обсуждение | вклад) Нет описания правки |
||
| (не показано 10 промежуточных версий 2 участников) | |||
| Строка 161: | Строка 161: | ||
out = out .. p.buildixablerecipes(frame) | out = out .. p.buildixablerecipes(frame) | ||
return out | return out | ||
end | |||
function p.getPagesInCategory() | |||
local categoryName = "Викиделы" -- Задайте название категории здесь | |||
local categoryPages = {} | |||
for page in mw.parse.categoryPages(categoryName) do | |||
table.insert(categoryPages, page.title) | |||
end | |||
if #categoryPages == 0 then | |||
return "Нет страниц в категории '" .. categoryName .. "'." | |||
end | |||
local result = "Страницы в категории '" .. categoryName .. "':\n" | |||
for _, title in ipairs(categoryPages) do | |||
result = result .. "* [[ " .. title .. " ]]\n" | |||
end | |||
return result | |||
end | end | ||
| Строка 342: | Строка 362: | ||
local input = buildreagents(frame, getchemicalreagents(recipe)) | local input = buildreagents(frame, getchemicalreagents(recipe)) | ||
local | local results = {} | ||
for _, v in pairs(recipe["effects"]) do | for _, v in pairs(recipe["effects"]) do | ||
table.insert( | table.insert(results, v.description) | ||
end | end | ||
local result = table.concat(results, "\n") | |||
out = frame:preprocess("{{Recipe Box" .. | out = frame:preprocess("{{Recipe Box" .. | ||
"|component-1=" .. input .. | "|component-1=" .. input .. | ||
"|name= " .. | |||
"|transformer={{Recipe Transformers|mixableRecipes}}" .. | "|transformer={{Recipe Transformers|mixableRecipes}}" .. | ||
"|result=" .. | "|result=" .. result .. "}}") | ||
return out | return out | ||
end | end | ||
| Строка 401: | Строка 421: | ||
-- return out | -- return out | ||
-- end | -- end | ||
return p | return p | ||