Модуль:Песочница/Pok: различия между версиями

мНет описания правки
мНет описания правки
Строка 44: Строка 44:


---------------------------------------------------------------------
---------------------------------------------------------------------
local function findRelatedTables(initialList)
    local results = {}
    local function recursiveSearch(tblId)
        if results[tblId] then
            return
        end
        results[tblId] = true
        for id, entry in pairs(tableData) do
            if type(entry) == "table" then
                for _, value in pairs(entry) do
                    if type(value) == "table" and value.tableId and value.tableId == tblId then
                        recursiveSearch(id)
                    end
                end
            end
        end
    end
    for _, tblId in ipairs(initialList) do
        recursiveSearch(tblId)
    end
    local res = {}
    for id in pairs(results) do
        table.insert(res, id)
    end
    return res
end
local function searchTableIdInStructure(struct, tableIds)
local function searchTableIdInStructure(struct, tableIds)
     if type(struct) ~= "table" then
     if type(struct) ~= "table" then