GE Lua Documentation

Press F to search!

validateFiles

Definition


-- @/lua/ge/extensions/freeroam/freeroamConfigurator.lua:326


M.validateFiles = function(validationFiles)
  if not validationFiles then
    return true
  end
  for _, file in ipairs(validationFiles) do
    -- check if file is a directory or a file
    if string.match(file, "[^/]+%.[%w]+$") then
      if not FS:fileExists(file) then
        return false
      end
    else
      if not FS:directoryExists(file) then
        return false
      end
    end
  end
  return true
end

Callers

@/lua/ge/extensions/freeroam/freeroamConfigurator.lua
  -- Validate that the level/spawnPoint still exists
  if currentConfiguration.spawnPointTile and not M.validateFiles(currentConfiguration.spawnPointTile.validationFiles) then
    log("W", "freeroamConfigurator", "Spawnpoint validation failed, fetching tile")
  -- Validate that the vehicle still exists
  if currentConfiguration.vehicleTile and not M.validateFiles(currentConfiguration.vehicleTile.validationFiles) then
    log("W", "freeroamConfigurator", "Vehicle validation failed, fetching tile")