Модуль:Песочница/Pok: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) Нет описания правки |
||
| Строка 1: | Строка 1: | ||
local p = {} | local p = {} | ||
-- | -- Загрузка данных | ||
local function | local function loadData(filePath) | ||
local | local page = mw.title.new(filePath) | ||
local content = page and page:getContent() | |||
return content and mw.text.jsonDecode(content) or nil | |||
end | end | ||
| Строка 73: | Строка 67: | ||
}) | }) | ||
local dataCache = | local dataCache = loadData('User:IanComradeBot/prototypes/entity sprite.json') | ||
if not data or type(data) ~= 'table' then | |||
return 'Ошибка: Невозможно загрузить данные из JSON.' | |||
end | |||
local discipline = frame.args[1] or "" | local discipline = frame.args[1] or "" | ||