GE Lua Documentation

Press F to search!

tableKeys

Definition


-- @/lua/common/utils.lua:596

-- returns a new array containing all table keys
function tableKeys(tbl, target)
  local keys = target or table.new(#tbl, 0)
  local keysidx = 0
  for k in pairs(tbl) do
    keysidx = keysidx + 1
    keys[keysidx] = k
  end
  return keys
end

Callers

@/lua/ge/extensions/flowgraph/nodes/input/blacklistAction.lua
    end
    sortedCategories = tableKeys(allCategories)
    local orderSort = function(a, b)
@/lua/ge/extensions/editor/materialEditor.lua

  sortedTags = tableKeys(tags)
  table.sort(sortedTags, sortFunc)
  local sortFunc = function(a,b) return string.lower(a) < string.lower(b) end
  groundModels = tableKeys(core_environment.groundModels) ---
  table.sort(groundModels, sortFunc)
@/lua/ge/extensions/gameplay/backgroundActivities/g2g.lua
          configs = {},
          paints = tableKeys(tableValuesAsLookupDict(v.model.paints or {}))
        }
@/lua/ge/extensions/gameplay/drag/dragBridge.lua
    local selectedConfig = eligibleVehicles[math.random(eligibleCount)]
    local paints = tableKeys(tableValuesAsLookupDict(core_vehicles.getModel(selectedConfig.model_key).model.paints or {}))
    local paintCount = #paints
@/lua/ge/extensions/gameplay/city.lua
  local spots = sites.parkingSpots
  local names = tableKeys(spots.byName)
  if not names[2] then -- needs at least two parking spots
@/lua/ge/extensions/editor/rendererComponents.lua
  if im.CollapsingHeader1("Lighting", im.TreeNodeFlags_DefaultOpen) then
    local sortedHDRsettings = tableKeys(HDRsettings)
    table.sort(sortedHDRsettings, sortFunc)
local function renderHDRLightingTab()
  local sortedHDRsettings = tableKeys(HDRsettings)
  table.sort(sortedHDRsettings, sortFunc)
@/lua/ge/extensions/flowgraph/nodes/vehicle/spawnVehicle.lua
          else
            allPaints = tableKeys(tableValuesAsLookupDict(modelData.model.paints or {})) -- if random paint is true
            if configData and configData.aggregates and configData.aggregates["Config Type"] then
@/lua/ge/extensions/editor/terrainMaterialsEditor.lua
  local groundModelName = terrainMtlCopyProxy.groundmodelName
  local groundModelNamesSorted = tableKeys(core_environment.groundModels)
  table.sort(groundModelNamesSorted)
  local groundModelName = terrainMtlCopyProxy.groundmodelName
  local groundModelNamesSorted = tableKeys(core_environment.groundModels)
  table.sort(groundModelNamesSorted)
@/gameplay/missionTypes/scatterPickup/customNodes/scatterStuffInZonesNode.lua
    if #zone.vertices > 2 then
      local type = tableKeys(zone.customFields.tags or {})[1] or "mixed"
      pointsByType[type] = pointsByType[type] or {}
@/lua/ge/extensions/editor/flowgraph/garbageDebug.lua
    self:setSortingValue(self.mgr.garbageData.graphSum)
    local graphIdsSortedByTotalGarbage = tableKeys(self.mgr.garbageData.graphs or {})
    table.sort(graphIdsSortedByTotalGarbage, function(a,b) return self.mgr.garbageData.graphs[a].value > self.mgr.garbageData.graphs[b].value end)

    local nodeIdsSortedByTotalGarbage = tableKeys(self.mgr.garbageData.nodes or {})
    table.sort(nodeIdsSortedByTotalGarbage, function(a,b) return self.mgr.garbageData.nodes[a].value > self.mgr.garbageData.nodes[b].value end)
@/lua/common/utils.lua
function tableKeysSorted(tbl, target)
  local res = tableKeys(tbl, target)
  table.sort(res, tableSortCompareMultiType)
@/lua/ge/extensions/freeroam/vueBigMap.lua
  if freeroam_bigMapMode then
    freeroam_bigMapMode.setOnlyIdsVisible(tableKeys(visibleIds))
  end
@/lua/ge/extensions/core/camera.lua

  if not arrayFindValueIndex(tableKeys(vdata.cameras), "onboard.driver") then
    vdata.cameras.driver = nil -- there's no driver data to feed the driver cam, so remove it
@/lua/common/jsonPrettyEncoderCustom.lua
local function tableKeysWeightSorted(tbl, tableWeights)
  return sortTableKeysByWeight(tableKeys(tbl), tableWeights)
end
@/lua/ge/extensions/flowgraph/nodes/vehicle/randomConfigProvider.lua
          configs = {},
          paints = tableKeys(tableValuesAsLookupDict(v.model.paints or {}))
        }
@/lua/ge/extensions/core/modmanager.lua
  end
  vehicles = tableKeys(vehicles)

  local keys = tableKeys(couldBe)
  if tableSize(keys) == 1 then
@/lua/ge/extensions/editor/missionEditor/objectives.lua
    end
    for i = 1, #tableKeys(self.mission.careerSetup.starsActive) do
      if im.Selectable1("Default Star " .. i, currentSlot == "Default Star " .. i) then
@/lua/ge/extensions/gameplay/markerInteraction.lua
  --table.clear(visibleIdsSorted)
  --tableKeys(visibleIds, visibleIdsSorted)
  --table.sort(visibleIdsSorted)
@/lua/ge/extensions/trackbuilder/trackBuilder.lua
local function setupGroundmodels()
  local gMNames = tableKeys(core_environment.groundModels)
  table.sort(gMNames, sortFunc)

  menuItemsSorted = tableKeys(menuItems)
  table.sort(menuItemsSorted)
  table.sort(menuItemsSorted)
  additionalMenuItemsSorted = tableKeys(additionalMenuItems)
  table.sort(additionalMenuItemsSorted)
@/gameplay/missionTypes/garageToGarage/constructor.lua
        configs = {},
        paints = tableKeys(tableValuesAsLookupDict(v.model.paints or {}))
      }
@/lua/ge/extensions/flowgraph/manager.lua
  -- pairs is non deterministic, so sort this ourselfs
  local graphKeys = tableKeys(self.graphs)
  table.sort(graphKeys)

  local macroKeys = tableKeys(self.macros)
  table.sort(macroKeys)

      local graphKeys = tableKeys(data.graphs)
      table.sort(graphKeys)

      local graphKeys = tableKeys(self.graphs)
      table.sort(graphKeys)
@/lua/common/graphpath.lua
      if childCount >= 2 then
        table.insert(branches, {node = node, links = tableKeys(graph[node]), sqDist = posNodeDist})
      end
@/lua/ge/extensions/career/modules/branches/leagues.lua
  local orderIndex = 1
  local skillIds = tableKeys(leaguesBySkill)
  table.sort(skillIds, function(a, b)
@/lua/ge/extensions/core/flowgraphManager.lua
M.refreshDependencies = function()
  local deps = tableKeys(M.runningProxies)
  M.dependencies = deps
@/lua/ge/extensions/editor/flowgraph/properties.lua
function C:_drawDataTable(path, cdata, v, savePath, saveCallback, keysEditable)
  local orderedKeys = tableKeys(v or {})
  table.sort(orderedKeys)
@/lua/ge/extensions/flowgraph/nodes/mission/selectGarageSpots.lua
  -- get all the endsSpots and shuffle them
  local possibleEndSpots = tableKeys(self.spots.byName)
  for i = #possibleEndSpots, 2, -1 do
      self.spots = self.pinIn.sitesData.value.parkingSpots
      self.names = tableKeys(self.spots.byName)
@/lua/ge/extensions/flowgraph/nodes/mission/selectHeistMissionSpots.lua
      self.spots = self.pinIn.sitesData.value.parkingSpots
      self.names = tableKeys(self.spots.byName)
      --SPLIT THE SPOTS USING TAGS
@/lua/ge/extensions/flowgraph/nodes/util/customLua.lua
  if im.BeginCombo("##loadNode", "Load from library...") then
    local sortedNames = tableKeys(customNodes)
    table.sort(sortedNames)
@/lua/ge/extensions/career/modules/delivery/pages.lua
      local changeText = ""
      for _, key in ipairs(career_branches.orderAttributeKeysByBranchOrder(tableKeys(change.attributeChange))) do
        changeText = changeText .. string.format('%s: %s%0.2f
', key, change.attributeChange[key] > 0 and "+" or "", change.attributeChange[key])
@/lua/ge/extensions/gameplay/missions/startTrigger.lua

    table.insert(allClusters, {type='coordinates', level=cluster[1].level, pos=newCenter, rot=cluster[1].rot, radius=radius, check=defaultLocationCheck, displayMarker=defaultLocationDisplayMarker, missionIds = tableKeys(missionIds), clusterId = clusterId})
  end
@/lua/ge/extensions/flowgraph/graph.lua
  if not lookup[nodeType] then
    log('E', 'flowgraph_graph.createNode', 'unable to find node type: "' .. tostring(nodeType) .. '". Available types: ' .. dumps(tableKeys(lookup)))
    return

  local nodeKeys = tableKeys(data.nodes)
  table.sort(nodeKeys)
@/lua/ge/extensions/ui/vehicleSelector/tileClustering.lua
  end
  local sources = tableKeys(sourcesByIconCount)
  table.sort(sources, function(a, b)
  end
  local sources = tableKeys(sourcesByIconCount)
  table.sort(sources, function(a, b)
@/lua/ge/extensions/gameplay/missions/missionTypes/editorHelper.lua
    local customFnCount = 0
    local sortedKeys = tableKeys(elem)
    table.sort(sortedKeys)
@/lua/ge/extensions/flowgraph/nodes/ui/updatedUI/endScreenWhole.lua
      entryFeeAsList = {}
      local attributesSorted = tableKeys(entryFee)
      table.sort(attributesSorted, career_branches.sortAttributes)
@/lua/ge/extensions/career/modules/vehicleShopping.lua
        local parkingSpots = gameplay_parking.getParkingSpots().byName
        local parkingSpotNames = tableKeys(parkingSpots)
@/lua/ge/extensions/editor/assetBrowser.lua
      if var.typeColors then
        local sortedTbl = tableKeys(var.typeColors)
        table.sort(sortedTbl)
@/lua/ge/extensions/gameplay/missions/missionScreen.lua
    local entryFeeAsList = {}
    local attributesSorted = tableKeys(entryFee)
    table.sort(attributesSorted, career_branches.sortAttributes)
@/lua/ge/extensions/editor/missionEditor/conditions.lua
  if not conditionsSortedCache then
    conditionsSortedCache = tableKeys(missionConditions)
    table.sort(conditionsSortedCache)
@/lua/ge/extensions/editor/flowgraph/nodelibrary.lua
  local match = string.lower(ffi.string(self.searchText))
  for _, t in ipairs(tableKeys(typeOrder)) do
    if match:find(t..": ") ~= nil then
@/lua/common/jbeam/optimization.lua
  -- Deterministic node ordering
  local sortedNodeKeys = tableKeys(nodes)
  table.sort(sortedNodeKeys)
@/lua/common/libs/xlsxlib/xlsxlib.lua
-- Helper function to get table keys
local function tableKeys(t)
  local keys = {}
@/lua/ge/extensions/career/modules/delivery/generator.lua
    end
    log("I","",string.format("Loaded %d item templates from %d files.", #tableKeys(parcelItemTemplates), #files))
  end
      end
      --print(string.format("Facility: %s provides systems: %s", fac.name, table.concat(tableKeys(fac.providedSystemsLookup),", " )))
      --print(string.format("Facility: %s receives systems: %s", fac.name, table.concat(tableKeys(fac.receivedSystemsLookup),", " )))
      --print(string.format("Facility: %s provides systems: %s", fac.name, table.concat(tableKeys(fac.providedSystemsLookup),", " )))
      --print(string.format("Facility: %s receives systems: %s", fac.name, table.concat(tableKeys(fac.receivedSystemsLookup),", " )))
    end

    log("I","",string.format("Setup Logistics Facilities: %d Facilities (%d only provide, %d mixed, %d only receive), %d Parking spots", #tableKeys(facilitiesById), countProviders, countMixed, countReceivers, #tableKeys(parkingSpotsByPath)))
    facilitiesSetup = true

    log("I","",string.format("Setup Logistics Facilities: %d Facilities (%d only provide, %d mixed, %d only receive), %d Parking spots", #tableKeys(facilitiesById), countProviders, countMixed, countReceivers, #tableKeys(parkingSpotsByPath)))
    facilitiesSetup = true
@/lua/ge/extensions/gameplay/drift/saveLoad.lua
    end
    --log("I","","Loaded " .. #tableKeys(spotsById) .. " drift spots and " .. loaded .. " drift score files.")
  end
@/lua/ge/extensions/core/multiseat.lua
  if logEnabled and players > 1 then log("D", "multiseat", "Settled for "..players.." players:  supported="..maxPlayers..", vehicles="..nVehicles..", devices="..nControllers.." (& mouse)") end
  local devnames = tableKeys(devices)
  table.sort(devnames)
@/lua/ge/extensions/campaign/photoSafari.lua
    M.description = {}
    M.photoSafarimissions = tableKeys(M.photoSafariData)
   for _,k in ipairs(M.photoSafarimissions) do
@/lua/ge/extensions/gameplay/crawl/saveSystem.lua

    log("I", logTag, "Loaded " .. #tableKeys(playerTrailsById) .. " player crawl trails and " .. loaded .. " crawl score files.")
  end
@/lua/ge/extensions/career/modules/branches/landing.lua
  end
  local keys = tableKeys(ret)
  career_branches.orderAttributeKeysByBranchOrder(keys)
@/lua/ge/extensions/gameplay/markers/parkingMarker.lua
    if count > 1 then
      if #tableKeys(iconExistence) > 1 then
        icon = ("poi_no-0") .. math.min(count, 9)
@/lua/ge/extensions/core/input/bindings.lua
  -- temp fix for having force feedback: wheel0 is before xinput0
  local sortedNodeKeys = tableKeys(devices)
  table.sort(sortedNodeKeys)
@/lua/ge/extensions/editor/iconOverview.lua
      editor.createIconAtlas()
      icons = tableKeys(editor.icons)
      table.sort(icons)
local function onEditorInitialized()
  icons = tableKeys(editor.icons)
  table.sort(icons)
@/lua/ge/extensions/gameplay/parking.lua
local function onSerialize()
  local data = {active = active, debugLevel = M.debugLevel, parkedVehIds = deepcopy(parkedVehIds), trackedVehIds = tableKeys(trackedVehData), vars = deepcopy(vars)}
  resetAll()
@/lua/ge/extensions/core/vehiclePaints.lua
  end
  log("I","",string.format("Found %d paints, %d paint collections, %d multiPaintSetups in %d paint libraries, %d same-name paint names", #tableKeys(paintsByIdCache), #tableKeys(paintCollectionsByIdCache), #tableKeys(multiPaintSetupsByIdCache), #tableKeys(core_vehicles.getPaintFiles()), multiNames))
end
  end
  log("I","",string.format("Found %d paints, %d paint collections, %d multiPaintSetups in %d paint libraries, %d same-name paint names", #tableKeys(paintsByIdCache), #tableKeys(paintCollectionsByIdCache), #tableKeys(multiPaintSetupsByIdCache), #tableKeys(core_vehicles.getPaintFiles()), multiNames))
end
  end
  log("I","",string.format("Found %d paints, %d paint collections, %d multiPaintSetups in %d paint libraries, %d same-name paint names", #tableKeys(paintsByIdCache), #tableKeys(paintCollectionsByIdCache), #tableKeys(multiPaintSetupsByIdCache), #tableKeys(core_vehicles.getPaintFiles()), multiNames))
end
  end
  log("I","",string.format("Found %d paints, %d paint collections, %d multiPaintSetups in %d paint libraries, %d same-name paint names", #tableKeys(paintsByIdCache), #tableKeys(paintCollectionsByIdCache), #tableKeys(multiPaintSetupsByIdCache), #tableKeys(core_vehicles.getPaintFiles()), multiNames))
end
  model.paints = model.paints or {}
  debugLog("Model has " .. #tableKeys(model.paints) .. " explicit paints: " .. table.concat(tableKeysSorted(model.paints), ", "))

  debugLog("Finished: Model has " .. #tableKeys(model.paints) .. " paints: " .. table.concat(tableKeysSorted(model.paints), ", "))
@/lua/ge/extensions/editor/util/editorElementHelper.lua
    local customFnCount = 0
    local sortedKeys = tableKeys(elem)
    table.sort(sortedKeys)
@/lua/ge/extensions/editor/levelValidator.lua
    if not types[log.type] then
      types[log.type] = #tableKeys(types) + 1
    end
@/lua/ge/extensions/gameplay/police.lua
  if not policeIds then
    policeIds = tableKeys(policeVehs) -- use all police vehicles
  elseif type(policeIds) == 'number' then -- backwards compatibility
@/lua/ge/extensions/editor/flowgraphEditor.lua
local function customLuaNodesManagerUi()
  local sortedNames = tableKeys(editor.getPreference('flowgraph.general.customLuaNodes'))
  table.sort(sortedNames)
@/lua/ge/extensions/editor/flowgraph/search.lua
  local match = string.lower(ffi.string(self.searchText))
  for _, t in ipairs(tableKeys(typeOrder)) do
    if match:find(t..": ") ~= nil then
@/lua/ge/extensions/flowgraph/groupHelper.lua
  local newGraph = self.mgr.graph
  local groupNode = newGraph.nodes[tableKeys(self.mgr.selectedNodes)[1]]
  local groupedGraph = groupNode:representsGraph()
@/lua/ge/extensions/career/branches.lua
    sortedBranches = {}
    local keysSorted = tableKeys(branchesByPath)
    table.sort(keysSorted, sortBranchNames)
local function orderBranchNamesKeysByBranchOrder(list)
  list = list or tableKeys(branchesById)
  table.sort(list, sortBranchNames)
@/lua/ge/extensions/flowgraph/nodes/ui/updatedUI/endScreenBegin.lua
      entryFeeAsList = {}
      local attributesSorted = tableKeys(entryFee)
      table.sort(attributesSorted, career_branches.sortAttributes)
@/lua/ge/extensions/freeroam/gasStations.lua
      local key = next(fuelTranslations)
      if #tableKeys(fuelTranslations) > 1 then
        key = "refuelMixed"
      local key = next(fuelTranslations)
      if #tableKeys(fuelTranslations) > 1 then
        key = "refuelMixed"
@/lua/ge/extensions/util/groundModelDebug.lua

  gms = tableKeys(core_environment.groundModels)
  table.sort(gms)

      vgmk = tableKeys(visibleGroundModels)
      table.sort(vgmk, function(a, b) return visibleGroundModels[a] > visibleGroundModels[b] end)
@/lua/ge/extensions/career/modules/playerAttributes.lua
      local rewards = {}
      for _, key in ipairs(career_branches.orderAttributeKeysByBranchOrder(tableKeys(change.attributeChange))) do
        if key:endswith("Reputation") then
@/lua/ge/extensions/core/funstuff.lua
  if not modelInfo then return end
  local paints = tableKeys(tableValuesAsLookupDict(modelInfo.model.paints or {}))
  local paint1, paint2, paint3 = paints[math.random(1, #paints)], paints[math.random(1, #paints)], paints[math.random(1, #paints)]
          configs = {},
          paints = tableKeys(tableValuesAsLookupDict(v.model.paints or {}))
        }
  local bestDistance = 0
  local targets = tableKeys(map.getMap().nodes)
  for i = 1, 10 do
@/lua/ge/extensions/flowgraph/nodes/gameplay/dragRace/generateDragOpponents.lua
  if modelData and modelData.model and modelData.model.paints then
    return tableKeys(tableValuesAsLookupDict(modelData.model.paints))
  end
@/lua/ge/ge_utils.lua
  local modelDataPaints = modelData and modelData.paints or {}
  local paintNames = tableKeys(modelDataPaints)
@/lua/ge/extensions/editor/dynamicDecals/layerTypes/linkedSet.lua

  local sortedKeys = tableKeys(layer.properties)
  table.sort(sortedKeys)
@/lua/ge/extensions/editor/util/vehicleFilterUtil.lua
        configs = {},
        paints = model and model.model and tableKeys(tableValuesAsLookupDict(model.model.paints or {})) or {}
      }