Модуль:Песочница/Pok: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 1: | Строка 1: | ||
-- Загрузка данных | -- Загрузка данных | ||
local data = mw.loadData("Модуль:Prototypes/Хранилище/Предмет/data") | local data = mw.loadData("Модуль:Prototypes/Хранилище/Предмет/data") | ||
local allSelectorData = mw.loadData("Модуль:Prototypes/Хранилище/Предмет/data2") | |||
local p = {} | local p = {} | ||
| Строка 98: | Строка 99: | ||
-- Обработка таблиц | -- Обработка таблиц | ||
getTableOutput = function(tableId) | getTableOutput = function(tableId) | ||
local allSelectors = loadData('User:IanComradeBot/prototypes/AllSelector.json') | |||
local tableData = findDataById( | local tableData = findDataById(allSelectors, tableId) | ||
if not tableData then return 'Таблица не найдена.' end | if not tableData then return 'Таблица не найдена.' end | ||
| Строка 240: | Строка 241: | ||
if not id then return 'Не указан ID.' end | if not id then return 'Не указан ID.' end | ||
if not data then return 'Не удалось загрузить данные.' end | if not data then return 'Не удалось загрузить данные.' end | ||
| Строка 254: | Строка 253: | ||
if subMode == 'chem' then | if subMode == 'chem' then | ||
return frame:preprocess('{{СollapsibleMenu|' .. getChemOutput( | return frame:preprocess('{{СollapsibleMenu|' .. getChemOutput(data, id) .. '}}') | ||
elseif subMode == 'contained' then | elseif subMode == 'contained' then | ||
return frame:preprocess('{{СollapsibleMenu|' .. getContainedOutput( | return frame:preprocess('{{СollapsibleMenu|' .. getContainedOutput(data, id) .. '}}') | ||
else | else | ||
return 'Неизвестный подрежим для framing: ' .. subMode | return 'Неизвестный подрежим для framing: ' .. subMode | ||
end | end | ||
elseif mode == 'chem' then | elseif mode == 'chem' then | ||
return frame:preprocess(getChemOutput( | return frame:preprocess(getChemOutput(data, id)) | ||
elseif mode == 'contained' then | elseif mode == 'contained' then | ||
return frame:preprocess(getContainedOutput( | return frame:preprocess(getContainedOutput(data, id)) | ||
elseif mode == 'rolls' then | elseif mode == 'rolls' then | ||
local entity = findDataById( | local entity = findDataById(data, id) | ||
if not entity then return 'ID не найден в данных.' end | if not entity then return 'ID не найден в данных.' end | ||