diff --git a/game/engines/default/engine/utils.lua b/game/engines/default/engine/utils.lua index ca6d719d8b800e091171885883657f07ab11b6ef..ce72dd12fbeebf14d65afdc75ca60cb9f573810c 100644 --- a/game/engines/default/engine/utils.lua +++ b/game/engines/default/engine/utils.lua @@ -263,20 +263,21 @@ function table.removeFromList(t, ...) end end -function table.check(t, fct, path) - if path then path = path..'/' else path = '' end +function table.check(t, fct, do_recurse, path) + if path and path ~= '' then path = path..'/' else path = '' end + do_recurse = do_recurse or function() return true end for k, e in pairs(t) do local tk, te = type(k), type(e) - if te == "table" and not e.__CLASSNAME then - local ok, err = table.check(e, fct, path..tostring(k)) + if te == "table" and not e.__CLASSNAME and do_recurse(e) then + local ok, err = table.check(e, fct, do_recurse, path..tostring(k)) if not ok then return nil, err end else local ok, err = fct(t, path..tostring(k), e, te) if not ok then return nil, err end end - if tk == "table" and not k.__CLASSNAME then - local ok, err = table.check(k, fct, path..tostring(k)) + if tk == "table" and not k.__CLASSNAME and do_recurse(k) then + local ok, err = table.check(k, fct, do_recurse, path..tostring(k)) if not ok then return nil, err end else local ok, err = fct(t, path.."<key>", k, tk)