Модуль:IanComradeBot/prototypes/StationEvent.json/data: различия между версиями
Материал из Space Station 14 Вики
Pok (обсуждение | вклад) Отмена версии 76247, сделанной Pok (обсуждение) Метка: отмена |
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) | ||
if success and type(data) == "table" then | |||
local filtered = {} | |||
for _, v in ipairs(data) do | |||
if not (type(v) == "string" and v:match("^%s*$")) then | |||
table.insert(filtered, v) | |||
end | |||
end | |||
return filtered | |||
else | |||
return {} | |||
end | |||
Версия от 23:22, 29 марта 2025
Для документации этого модуля может быть создана страница Модуль:IanComradeBot/prototypes/StationEvent.json/data/doc
local title = mw.title.new("Участник:IanComradeBot/prototypes/StationEvent.json")
local jsonData = title and title:getContent() or ""
local success, data = pcall(mw.text.jsonDecode, jsonData)
if success and type(data) == "table" then
local filtered = {}
for _, v in ipairs(data) do
if not (type(v) == "string" and v:match("^%s*$")) then
table.insert(filtered, v)
end
end
return filtered
else
return {}
end