Модуль:Песочница/Pok: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 34: | Строка 34: | ||
-- Локальные функции | -- Локальные функции | ||
local findDataById, formatContent, getContentsOutput, processNestedSelectors, getTableOutput, getContainedOutput, getChemOutput, handleGroupSelector, handleAllSelector, handleNestedSelector | local findDataById, formatContent, getContentsOutput, processNestedSelectors, getTableOutput, getContainedOutput, getChemOutput, handleGroupSelector, handleAllSelector, handleNestedSelector | ||
-- Поиск данных по ID через индекс | -- Поиск данных по ID через индекс | ||
findDataById = function(itemDataIndex, id) | findDataById = function(itemDataIndex, id) | ||
if not itemDataIndex then return nil end | |||
for _, item in ipairs(itemDataIndex) do | for _, item in ipairs(itemDataIndex) do | ||
if item.id == id then | if item.id == id then | ||
| Строка 53: | Строка 43: | ||
end | end | ||
end | end | ||
return nil | |||
end | end | ||
| Строка 148: | Строка 139: | ||
if not item then return '' end | if not item then return '' end | ||
local result = | local result = "" | ||
-- Обработка StorageFill | -- Обработка StorageFill | ||
if item.StorageFill and item.StorageFill.contents then | if item.StorageFill and item.StorageFill.contents then | ||
result | result = result getContentsOutput(item.StorageFill.contents) | ||
-- Обработка EntityTableContainerFill | -- Обработка EntityTableContainerFill | ||
| Строка 161: | Строка 152: | ||
if containers.entity_storage then | if containers.entity_storage then | ||
if containers.entity_storage.children then | if containers.entity_storage.children then | ||
result | result = result processNestedSelectors(containers.entity_storage.children, visited) | ||
end | end | ||
if containers.entity_storage.tableId then | if containers.entity_storage.tableId then | ||
result | result = result getTableOutput(containers.entity_storage.tableId, visited) | ||
end | end | ||
end | end | ||
| Строка 170: | Строка 161: | ||
-- Обработка storagebase | -- Обработка storagebase | ||
if containers.storagebase and containers.storagebase.tableId then | if containers.storagebase and containers.storagebase.tableId then | ||
result | result = result getTableOutput(containers.storagebase.tableId, visited) | ||
end | end | ||
end | end | ||
return | return result | ||
end | end | ||