Модуль:IanComradeBot/prototypes/StationEvent.json/data: различия между версиями
Pok (обсуждение | вклад) Новая страница: «local title = mw.title.new("Участник:IanComradeBot/prototypes/StationEvent.json") local jsonData = title and title:getContent() or "" local success, data = pcall(mw.text.jsonDecode, jsonData) return (success and type(data) == "table") and data or {}» |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 2: | Строка 2: | ||
local jsonData = title and title:getContent() or "" | local jsonData = title and title:getContent() or "" | ||
local success, data = pcall(mw.text.jsonDecode, jsonData) | local success, data = pcall(mw.text.jsonDecode, jsonData) | ||
local events = {} | |||
if success and type(data) == "table" then | |||
for _, event in ipairs(data) do | |||
if event.id then | |||
events[event.id] = event | |||
end | |||
end | |||
end | |||
return events | |||