GE Lua Documentation

Press F to search!

tableContains

Definition


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

-- checks if the table contains a certain value. Non-recursive
function tableContains(t, element)
  return tableFindKey(t, element) ~= nil
end

Callers

@/lua/ge/extensions/scenario/scenarios.lua
      if type(entry) == 'string' then
        if not tableContains(triggers, entry) and not tableContains(waypoints, entry) and entry:sub(1,12) ~= '__generated_' then
          log('E', logTag, 'Lapconfig entry is Invalid! It should be either a Trigger or Waypoint: '..entry)
      if type(entry) == 'string' then
        if not tableContains(triggers, entry) and not tableContains(waypoints, entry) and entry:sub(1,12) ~= '__generated_' then
          log('E', logTag, 'Lapconfig entry is Invalid! It should be either a Trigger or Waypoint: '..entry)
                        }
    if scenario.attemptsInfo.failAttempts and not scenario.attemptsInfo.failedAttemptReported and tableContains(scenario.attemptsInfo.failAttempts, data.triggerName) then
      extensions.hook("onAttemptFailed", attemptData)
      scenario.attemptsInfo.waitTimerActive = true
    elseif scenario.attemptsInfo.completeAttempt and tableContains(scenario.attemptsInfo.completeAttempt, data.triggerName) then
      extensions.hook("onAttemptCompleted", attemptData)
@/lua/common/jbeam/io.lua
        partSlotMap[cacheData.namespace][slotType] = partSlotMap[cacheData.namespace][slotType] or {}
        if tableContains(partSlotMap[cacheData.namespace][slotType], partName) then
          log('E', 'jbeam.loadJBeamFile', 'Duplicate part found: ' .. tostring(partName) .. ' from file ' .. tostring(filename))
@/lua/ge/extensions/flowgraph/pin.lua
function C:getTableType()
  if self.type == "table" or (type(self.type) == "table" and tableContains(self.type, "table")) then
    return self.tableType or "generic"

    if self.type == "table" or (type(self.type) == 'table' and tableContains(self.type,'table')) then
      im.TextUnformatted("Table type: "..self:getTableType())
@/lua/ge/extensions/util/export.lua
  --   end
  --   if tableContains(parentNode ,nodeId) then
  --     log("E", logTag, string.rep("    ", i).. "already parented or looping tree!!! "..dbgNodeName(gltfRoot,nodeId))
    gltfCurrentMaterial.instanceDiffuse = _getMaterialStages(materialObj, "instanceDiffuse", gltfCurrentMaterial.activeLayers)
    if tableContains(gltfCurrentMaterial.instanceDiffuse, true) then
      local veh = getPlayerVehicle(0)

    if tableContains(gltfCurrentMaterial.instanceDiffuse, true) or gltfCurrentMaterial.colorPaletteMap then
      local veh = getPlayerVehicle(0)
@/lua/ge/extensions/editor/objectTool.lua
    imgui.PushID1(tostring(k))
    local isSel = tableContains(hiddenObjectIconClasses, classes[k])
    if imgui.Selectable1(classes[k], isSel) then
    for _, val in ipairs(classes) do
      worldEditorCppApi.setHideIconClass(val, tableContains(hiddenObjectIconClasses, val))
    end
@/lua/ge/extensions/flowgraph/nodes/gameplay/sites/location.lua
  for _, lnk in pairs(self.graph.links) do
    if lnk.sourceNode == self and tableContains(self.oldOptions, lnk.sourcePin.name) then
      table.insert(flowLinks, lnk)
  for _, pn in pairs(self.pinOut) do
    if tableContains(self.oldOptions or {}, pn.name) then
      table.insert(outPins, pn)
@/lua/ge/extensions/editor/dynamicDecals/layerTypes/decal.lua
        if im.ImGuiTextFilter_PassFilter(meshesFilter, name) then
          local enabled = meshes == nil or tableContains(meshes, name)
          if im.Checkbox(string.format("##%s_shapeMesh_%d_checkbox", widgetId, i), editor.getTempBool_BoolBool(enabled)) then
@/lua/common/jbeam/slotSystem.lua
      return true, nil
    elseif type(part.slotType) == 'table' and not tableContains(part.slotType, slot.type) then
      return true, nil
    if type(part.slotType) == 'string' then
      local fits = tableContains(slot.allowTypes, part.slotType)
      return fits, fits and nil or "Part type not in allowed types"
      for _, slottype in ipairs(part.slotType) do
        if tableContains(slot.allowTypes, slottype) then
          allowListed = true
      for _, slottype in ipairs(part.slotType) do
        if tableContains(slot.denyTypes, slottype) then
          denyListed = true
@/lua/ge/extensions/editor/dynamicDecals/textures.lua
  for _, filePath in ipairs(filePaths) do
    if not tableContains(sel, filePath) then
      table.insert(sel, filePath)
          if im.ImTextureHandlerIsCached(filePath) then
            if im.ImageButton(string.format("##textures_imageButton_%s", filePath), editor.getTempTextureObj(filePath).texId, im.ImVec2(thumbnailSize, thumbnailSize), im.ImVec2Zero, im.ImVec2One, (sel and tableContains(sel, filePath)) and selectedTextureCol.Value or nil) then
              handleTextureImageTileClicked(filePath, textureFilePaths)
              im.PushID1("Texture_" .. tostring(k))
              if im.ImageButton(string.format("##textures_imageButton_%s", filePath), editor.getTempTextureObj(filePath).texId, im.ImVec2(thumbnailSize, thumbnailSize), im.ImVec2Zero, im.ImVec2One, (sel and tableContains(sel, filePath)) and selectedTextureCol.Value or nil) then
                handleTextureImageTileClicked(filePath, textureFilePaths)
        if im.ImTextureHandlerIsCached(filePath) then
          if im.ImageButton(string.format("##textures_imageButton_%s", filePath), editor.getTempTextureObj(filePath).texId, im.ImVec2(thumbnailSize, thumbnailSize), im.ImVec2Zero, im.ImVec2One, (sel and tableContains(sel, filePath)) and selectedTextureCol.Value or nil) then
            handleTextureImageTileClicked(filePath, textureFilePaths)
            im.PushID1("Texture_" .. tostring(k))
            if im.ImageButton(string.format("##textures_imageButton_%s", filePath), editor.getTempTextureObj(filePath).texId, im.ImVec2(thumbnailSize, thumbnailSize), im.ImVec2Zero, im.ImVec2One, (sel and tableContains(sel, filePath)) and selectedTextureCol.Value or nil) then
              handleTextureImageTileClicked(filePath, textureFilePaths)
@/lua/ge/extensions/editor/slotTrafficEditor.lua
        local node = mapNodes[nid]
        if not tableContains(tempNodes, nid) then
          local minSphereHitDist, _ = intersectsRay_Sphere(ray.pos, rayDir, node.pos, node.radius)
@/lua/ge/extensions/util/trackBuilder/markers.lua
          for changeIndex = endIndex, startIndex, -1 do
            if tableContains(markerChanges[nameOfField], changeIndex) then
              doChange = true
@/lua/ge/extensions/editor/assetBrowser.lua
    local ext = file.aliases_extension
    if tableContains(var.imageFileTypes, ext) then
      var.filteredAssets[k].type = "image"
  }
  if tableContains(var.imageFileTypes, file.simpleFileType) then
    file.type = "image"
@/lua/ge/extensions/editor/sitesEditor/sortedListDisplay.lua
      for _, compareId in ipairs(self.selections) do
        if not tableContains(self.objects[compareId].customFields.sortedTags, tag) then
          goto continue
    if not obj.isProcedural and ((filter == nil) or (filter and string.find(string.lower(obj.name), filter) or self.currentElement == obj)) then
      if tableContains(self.selections, obj.id) then
        if im.SmallButton("X##" .. obj.id) then
@/lua/common/jbeam/sections/licenseplatesSkins.lua
        useLicensePlate = true
        if part.licenseplateFormat and not tableContains(licensePlateUsedFormats,part.licenseplateFormat) then
          table.insert(licensePlateUsedFormats, part.licenseplateFormat)
          table.insert(licensePlateUsedFormats, part.licenseplateFormat)
        elseif not part.licenseplateFormat and not tableContains(licensePlateUsedFormats,"30-15") then
          table.insert(licensePlateUsedFormats, "30-15")
@/lua/ge/extensions/flowgraph/nodes/ui/missionEndScreen.lua
  for _, lnk in pairs(self.graph.links) do
    if lnk.sourceNode == self and tableContains(self.oldOptions, lnk.sourcePin.name) then
      table.insert(flowLinks, lnk)
    end
    if lnk.targetNode == self and tableContains(self.oldOptions, lnk.targetPin.name) then
      table.insert(strLinks, lnk)
  for _, pn in pairs(self.pinOut) do
    if tableContains(self.oldOptions, pn.name) then
      table.insert(outPins, pn)
@/lua/ge/extensions/editor/terrainMaterialsEditor.lua
  table.sort(groundModelNamesSorted)
  if not tableContains(groundModelNamesSorted, string.upper(groundModelName)) then groundModelName = "" end
  im.Text("Ground Model:")
  table.sort(groundModelNamesSorted)
  if not tableContains(groundModelNamesSorted, string.upper(groundModelName)) then groundModelName = "" end
  im.Text("Ground Model:")
@/lua/ge/extensions/editor/resourceChecker/resourceUtil.lua
          if not usages[p] then usages[p] = {} end
          if not tableContains(usages[p], k) then table.insert(usages[p], k) end
        end
@/lua/ge/extensions/flowgraph/nodes/ui/endStats.lua
        --direction, type, name, default, description, autoNumber
        if type(p[2]) == 'table' and tableContains(p[2],'table') then
          local pin = self:createPin('in',p[2],p[1]..'_'..i)
@/lua/ge/extensions/flowgraph/nodes/ui/imgui/imDialogue.lua
    end
    if lnk.targetNode == self and tableContains(self.oldOptions, lnk.targetPin.name) then
      table.insert(flowLinks, lnk)
  for _, pn in pairs(self.pinInLocal) do
    if tableContains(self.oldOptions, pn.name) then
      table.insert(inPins, pn)
@/lua/ge/extensions/career/modules/branches/leagues.lua
  for id, l in pairs(leaguesById) do
    if tableContains(l.missions, missionId) then
      local league = formatLeague(l)
@/lua/common/libs/xlsxlib/xlsxlib.lua
-- Helper function to check if a table contains a value
local function tableContains(t, value)
  for _, v in ipairs(t) do
  local sharedStrings = {}
  if sharedStringsFile and tableContains(fileList, sharedStringsFile) then
    sharedStrings = parseSharedStrings(zip, sharedStringsFile)
@/lua/ge/extensions/flowgraph/nodes/ui/updatedUI/endScreenWhole.lua
  for _, lnk in pairs(self.graph.links) do
    if lnk.sourceNode == self and tableContains(self.oldOptions, lnk.sourcePin.name) then
      table.insert(flowLinks, lnk)
    end
    if lnk.targetNode == self and tableContains(self.oldOptions, lnk.targetPin.name) then
      table.insert(strLinks, lnk)
  for _, pn in pairs(self.pinOut) do
    if tableContains(self.oldOptions, pn.name) then
      table.insert(outPins, pn)
@/lua/ge/extensions/flowgraph/nodes/ui/updatedUI/endScreenBegin.lua
  for _, lnk in pairs(self.graph.links) do
    if lnk.sourceNode == self and tableContains(self.oldOptions, lnk.sourcePin.name) then
      table.insert(flowLinks, lnk)
    end
    if lnk.targetNode == self and tableContains(self.oldOptions, lnk.targetPin.name) then
      table.insert(strLinks, lnk)
  for _, pn in pairs(self.pinOut) do
    if tableContains(self.oldOptions, pn.name) then
      table.insert(outPins, pn)
@/lua/ge/extensions/career/saveSystem.lua
      local possiblePath = "/" .. path .. "/autosave" .. i
      if not tableContains(folders, possiblePath) then
        resultSave = possiblePath
@/lua/ge/extensions/editor/main.lua

      if M.safeMode and not tableContains(safeModeExtensionNames, extName) then
        allowLoad = false
      else
        if tableContains(disallowedExtensions, extName) then
          allowLoad = false
@/lua/ge/main.lua
    for _,v in ipairs(editorExtensions) do
      if not tableContains(startupExtensions, v) then
        table.insert(startupExtensions, v)
@/lua/ge/extensions/flowgraph/nodes/scene/storeStatics.lua
    if hoverStore then
      if tableContains(sortedObjectIds, e.currentId) then
        editor.uiIconImage(editor.icons.check_box,im.ImVec2(20, 20))
      -- remvoe object from objects list if needed
      --if tableContains(self.objects, obj) then
        local idx = nil
@/lua/ge/extensions/editor/dynamicDecals/settings.lua
      if im.ImGuiTextFilter_PassFilter(materialsFilter, name) then
        local enabled = tableContains(materialIndices, id)
        if im.Checkbox(string.format("##%s_material_%d_checkbox", widgetId, id), editor.getTempBool_BoolBool(enabled)) then
@/lua/ge/extensions/flowgraph/nodes/gameplay/sites/parkingspot.lua
  for _, lnk in pairs(self.graph.links) do
    if lnk.sourceNode == self and tableContains(self.oldOptions, lnk.sourcePin.name) then
      table.insert(flowLinks, lnk)
  for _, pn in pairs(self.pinOut) do
    if tableContains(self.oldOptions or {}, pn.name) then
      table.insert(outPins, pn)
@/lua/ge/extensions/editor/fileDialog.lua
          local favs = editor.getPreference("files.fileDialog.favourites")
          if not tableContains(favs, currentPath) then
            if im.MenuItem1("Add current path") then
@/lua/ge/extensions/career/modules/inventory.lua
      local thumbnailFilename = currentSavePath .. "/career/vehicles/" .. id .. ".png"
      if vehiclesThumbnailUpdate and tableContains(vehiclesThumbnailUpdate, id) and inventoryIdToVehId[id] then
        finishedSaveTasks["thumbnail" .. id] = false
@/lua/ge/extensions/flowgraph/nodes/ui/endScreen.lua
  for _, lnk in pairs(self.graph.links) do
    if lnk.sourceNode == self and tableContains(self.oldOptions, lnk.sourcePin.name) then
      table.insert(flowLinks, lnk)
    end
    if lnk.targetNode == self and tableContains(self.oldOptions, lnk.targetPin.name) then
      table.insert(strLinks, lnk)
  for _, pn in pairs(self.pinOut) do
     if tableContains(self.oldOptions, pn.name) then
        table.insert(outPins, pn)
  for _, pn in pairs(self.pinInLocal) do
    if tableContains(self.oldOptions, pn.name) then
      table.insert(inPins, pn)
@/lua/ge/extensions/editor/decalEditor.lua
    local name = template:__tostring()
    if not tableContains(hiddenTemplates, name) then
      table.insert(templates, template)
@/lua/ge/extensions/editor/sceneTree.lua
  if not editor.selection or not editor.selection.object or not node then return end
  if tableContains(editor.selection.object, node.id) then
    table.insert(instance.selectedNodes, node)
    local renamer = function(func, node, objectIds)
      if tableContains(objectIds, node.id) then
        local object = scenetree.findObjectById(node.id)
@/lua/ge/extensions/career/modules/fuel.lua
  for index, tankData in ipairs(fuelData) do
    if not tableContains(energyTypes, tankData.energyType) then
      table.insert(energyTypes, tankData.energyType)
@/lua/ge/extensions/ui/bindingsLegend.lua
            for _, modifier in ipairs(modifierNames) do
              if not tableContains(bindingModifiers, modifier) then
                modifiersMatch = false
@/lua/common/extensions.lua
  for k, m in pairs(luaMods) do
    local ignoreExtension = tableContains(doNotSerializeModules, m.__extensionName__)
    if not ignoreExtension then
  for _, v in ipairs(tempResolvedModules) do
    local ignoreExtension = tableContains(doNotSerializeModules, v.__extensionName__)
    if ignoreExtension then
@/lua/ge/extensions/scenario/waypoints.lua
  for _,wpName in ipairs(scenario.lapConfig) do
    if not tableContains(data, wpName) then
      table.insert(newLapConfig, wpName)
@/lua/ge/extensions/util/richPresence.lua
      end
      if M.state.levelIdentifier and M.state.levelIdentifier ~= "" and tableContains(lvlAssets,M.state.levelIdentifier)then
        dActivity.asset_largeimg= "lvl_"..M.state.levelIdentifier
      end
      -- if M.state.vehicleJbeam and M.state.vehicleJbeam ~= "" and tableContains(vehAssets,M.state.vehicleJbeam) then
      --   dActivity.asset_smallimg= M.state.vehicleJbeam
@/lua/ge/extensions/editor/assetManagementTool.lua

    if assetsByHash[hash] and not tableContains(assetsByHash[hash].paths, filename) then
      table.insert(assetsByHash[hash].paths, filename)

      if allAssetsWithHashes[hash] and not tableContains(allAssetsWithHashes[hash].paths, filename) then
        table.insert(allAssetsWithHashes[hash].paths, filename)
      for _, filename in ipairs(asset.paths) do
        if assetsByHash[hash] and not tableContains(assetsByHash[hash].paths, filename) then
          table.insert(assetsByHash[hash].paths, filename)
@/lua/ge/extensions/flowgraph/nodes/ui/selectButtons.lua
    end
    if lnk.targetNode == self and tableContains(self.oldOptions, lnk.targetPin.name) then
      table.insert(flowLinks, lnk)
  for _, pn in pairs(self.pinOut) do
    if tableContains(self.oldOptions, pn.name) then
      table.insert(outPins, pn)
  for _, pn in pairs(self.pinInLocal) do
    if tableContains(self.oldOptions, pn.name) then
      table.insert(inPins, pn)
@/lua/ge/extensions/scenario/busdriver.lua
      exitTggBeforeTimer = false
      if tableContains(passedWp, data.triggerName) then guihooks.trigger('ScenarioRealtimeDisplay', {msg = 'scenarios.busRoutes.alreadyStop'});return end
      -- if busConfig.strictStop then
        end
        if cur > 1 and not tableContains(passedWp, currentLine.tasklist[cur-1][1]) then
          fail( "scenarios.busRoutes.skip" )
      -- if not busConfig.strictStop then
      --   if not tableContains(passedWp, data.triggerName) then
      --     table.insert( passedWp, data.triggerName )
  if data.type and data.type == "buswp" and data.event == "enter" then
    if not tableContains(passedWp, data.triggerName) then
      table.insert( passedWp, data.triggerName )
      -- if busConfig.strictStop then
        if not tableContains(passedWp, state.triggerName) then
          table.insert( passedWp, state.triggerName )
@/lua/ge/extensions/core/vehicles.lua
  for key, value in pairs(data) do
    if tableContains(range, key) then
      if not destination[key] then
      end
    elseif tableContains(convertToRange, key) then
      if type(data[key]) == 'number' then
      end
    elseif tableContains(convertToDict, key) then
      if not destination[key] then
      end
    elseif tableContains(filtersWhiteList, key) then
      if not destination[key] then
  for key, value in pairs(data) do
    if tableContains(range, key) or tableContains(convertToRange, key) then
      if not destination[key] then
  for key, value in pairs(data) do
    if tableContains(range, key) or tableContains(convertToRange, key) then
      if not destination[key] then
      end
    elseif tableContains(convertToDict, key) then
      if not destination[key] then
      end
    elseif tableContains(filtersWhiteList, key) then
      if not destination[key] then
      for propName, propVal in pairs(value.aggregates) do
        if tableContains(finalRanges, propName) then
          if filter[propName] then
@/lua/ge/extensions/core/input/actionFilter.lua
        for _, actionName in ipairs(actionTemplates[entry]) do
          if not tableContains(actionWhitelist, actionName) then
            table.insert(template, actionName)
@/lua/ge/extensions/career/career.lua
    local objId = be:getObject(i):getID()
    if not tableContains(safeIds, objId) then
      be:getObject(i):delete()
@/lua/ge/extensions/flowgraph/manager.lua
        elseif not self.graph:pinsCompatible(startPin, endPin) then
          if (startPin.type == "table" or (type(startPin.type) == "table" and tableContains(startPin.type, "table")))
                  and (endPin.type == "table" or (type(endPin.type) == "table" and tableContains(endPin.type, "table")))
          if (startPin.type == "table" or (type(startPin.type) == "table" and tableContains(startPin.type, "table")))
                  and (endPin.type == "table" or (type(endPin.type) == "table" and tableContains(endPin.type, "table")))
                  and (startPin:getTableType() ~= endPin:getTableType() and startPin:getTableType() ~= 'generic' and endPin:getTableType() ~= 'generic') then
@/lua/ge/extensions/flowgraph/nodes/gameplay/race/raceEndScreen.lua
    end
    if lnk.targetNode == self and tableContains(self.oldOptions, lnk.targetPin.name) then
      table.insert(flowLinks, lnk)
  for _, pn in pairs(self.pinInLocal) do
    if tableContains(self.oldOptions, pn.name) then
      table.insert(inPins, pn)
@/lua/ge/extensions/editor/dynamicDecals/fonts.lua
    local fontName = string.sub(filename, 1, #filename - (#ext + 1))
    if not tableContains(generatedFontAtlases, fontName) then
      -- return false when craetion failed
@/lua/ge/extensions/flowgraph/states.lua
  for id, state in pairs(self.states) do
    if tableContains(state.depth, lastId) then
      table.insert(ids, id)
@/lua/ge/extensions/core/settings/settings.lua
  for k,_ in pairs(newState) do
    if not tableContains(graphicQualityGroups, k) then
      table.insert(sortedKeys, k)
@/lua/ge/extensions/ui/topBar.lua
    local isBlacklisted = item.blackListStates and M.state.currentUIState and
                              tableContains(item.blackListStates, M.state.currentUIState)
    local isHidden = item.isHidden and item.isHidden()