Aleksei-bird 7c9c708c92 Первый фикс
Пачки некоторых позиций увеличены
2024-03-01 20:54:33 +03:00

16 lines
456 B
Lua

--------------------------------------------------------------------
-- a generic function to walk into structure to manage avoid error when it does not exists.
local function walk(from, fields)
if type(from) ~= "table" then return nil end
local x = from
if type(fields)~="table" then fields = {fields} end
for _,field in ipairs(fields) do
if type(x)~="table" or x[field] == nil then
return nil
end
x = x[field]
end
return x
end
return walk