Модуль:Песочница/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 allSelectorData = mw.loadData("Модуль:Prototypes/Хранилище/Предмет/data2")
    local allSelectors = loadData('User:IanComradeBot/prototypes/AllSelector.json')
     local tableData = findDataById(buildIndex(allSelectorData), tableId)
     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
    local dataIndex = buildIndex(data)


     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(dataIndex, id) .. '}}')
             return frame:preprocess('{{СollapsibleMenu|' .. getChemOutput(data, id) .. '}}')
         elseif subMode == 'contained' then
         elseif subMode == 'contained' then
             return frame:preprocess('{{СollapsibleMenu|' .. getContainedOutput(dataIndex, id) .. '}}')
             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(dataIndex, id))
         return frame:preprocess(getChemOutput(data, id))
     elseif mode == 'contained' then
     elseif mode == 'contained' then
         return frame:preprocess(getContainedOutput(dataIndex, id))
         return frame:preprocess(getContainedOutput(data, id))
     elseif mode == 'rolls' then
     elseif mode == 'rolls' then
         local entity = findDataById(dataIndex, id)
         local entity = findDataById(data, id)
         if not entity then return 'ID не найден в данных.' end
         if not entity then return 'ID не найден в данных.' end