GE Lua Documentation

Press F to search!

saveVehicleCollection

Definition


-- @/lua/ge/extensions/core/vehicle/partmgmt.lua:359

local function saveVehicleCollection(collectionTree, filename)
  log('D', 'partmgmt', 'saving vehicle collection... ' .. filename)

  local vehicles = compileVehicleCollection(collectionTree)

  local res = {}
  res.format = 4
  res.vehicles = vehicles

  local writeRes = jsonWriteFile(filename, res, true)
  if writeRes then
    log('D', 'partmgmt', 'vehicle collection saved to ' .. filename)
    guihooks.trigger("VehicleconfigSaved", {})
  else
    log('W', "vehicles.save", "unable to save config: "..filename)
  end
  guihooks.trigger('Message', {ttl = 15, msg = 'Configuration saved', icon = 'directions_car'})
end

Callers