arrayFindValueIndex
Definition
-- @/lua/common/utils.lua:763
function arrayFindValueIndex(t, val)
for i = 1, #t do
if t[i] == val then
return i
end
end
return false
end
Callers
@/lua/ge/extensions/gameplay/drag/debug.lua
local currId = editor.selection.object[1]
if not classNames or arrayFindValueIndex(classNames, scenetree.findObjectById(currId).className) then
id = currId
@/lua/ge/extensions/editor/shapeEditor.lua
for k,v in pairs(fdata) do
if arrayFindValueIndex(skipFields,k) == false then
highlightMaterial:setField(k, 0, originalMaterial:getField(k,0))
@/lua/ge/extensions/ui/topBar.lua
local activeIndex = M.state.activeItem and arrayFindValueIndex(M.state.visibleItems, M.state.activeItem) or 1
local activeIndex = M.state.activeItem and arrayFindValueIndex(M.state.visibleItems, M.state.activeItem) or 1
@/lua/ge/extensions/gameplay/traffic.lua
local obj = getObjectByID(id)
local idx = arrayFindValueIndex(trafficAiVehsList, id)
if idx then table.remove(trafficAiVehsList, idx) end
@/lua/ge/extensions/gameplay/police.lua
local veh = getObjectByID(propId or 0)
if veh and not gameplay_traffic.getTrafficData()[propId] and not arrayFindValueIndex(policePropIds, propId) then
table.insert(policePropIds, propId)
local function removeProp(propId) -- removes a prop from the props list
local idx = arrayFindValueIndex(policePropIds, propId or 0)
if idx then
@/lua/ge/extensions/editor/barriersEditor.lua
if contained[elem.dirInLevel] and not elem.selected then
table.remove(path.prefabs,arrayFindValueIndex(path.prefabs, elem.dirInLevel))
end
@/lua/ge/extensions/editor/objectToSplineEditor.lua
local currId = editor.selection.object[1]
if not classNames or arrayFindValueIndex(classNames, scenetree.findObjectById(currId).className) then
id = currId
@/lua/ge/extensions/editor/api/object.lua
for i = 1, tableSize(idArray) do
if not arrayFindValueIndex(editor.selection.object, idArray[i]) then
table.insert(editor.selection.object, idArray[i])
for i = 1, tableSize(idArray) do
idx = arrayFindValueIndex(editor.selection.object, idArray[i])
if idx then
for i = 1, tableSize(idArray) do
idx = arrayFindValueIndex(editor.selection.object, idArray[i])
if idx then
@/lua/ge/extensions/editor/sitesEditor/sortedListDisplay.lua
local idx = mode ~= 'add' and arrayFindValueIndex(self.selections, id)
if idx then
end
local selected = arrayFindValueIndex(self.selections, obj.id) and true or false
local mode
@/lua/ge/extensions/editor/flowgraph/overview.lua
gr:printStructure()
--if gr.parentId and not arrayFindValueIndex(gr.parent.children, gr) then
-- print("Orphaned Graph: " .. gr:toString() .. " parent: " .. gr.parent:toString())
gr:printStructure()
--if gr.parent and not arrayFindValueIndex(gr.parent.children, gr) then
-- print("Orphaned Graph: " .. gr:toString() .. " parent: " .. gr.parent:toString())
@/lua/ge/extensions/editor/sceneTree.lua
-- table.insert(node.renderChildrenOrder, objId)
local childIndex = arrayFindValueIndex(node.renderChildrenOrder, objId)
if not childIndex then
groupNode.children[childId] = nil
local childIndex = arrayFindValueIndex(groupNode.renderChildrenOrder, childId)
if childIndex then
if child then
local childIndex = arrayFindValueIndex(groupNode.renderChildrenOrder, childId)
if not childIndex then
@/lua/ge/extensions/gameplay/traffic/vehicle.lua
if obj.jbeam == 'unicycle' and obj:isPlayerControlled() then modelType = 'player' end
if not modelData or not arrayFindValueIndex({'car', 'truck', 'automation', 'traffic', 'proptraffic', 'player'}, modelType) or obj.ignoreTraffic then
log('I', logTag, string.format('Ignoring traffic vehicle due to invalid vehicle type: %d', id))
@/lua/ge/extensions/flowgraph/graph.lua
while current ~= root do
table.insert(indexes, 1, arrayFindValueIndex(current:getParent():getChildren(), current))
current = current:getParent()
@/lua/ge/extensions/editor/flowgraph/nodelibrary.lua
--for _, tag in ipairs(tagIndex) do
-- if arrayFindValueIndex(node.node.tags or {}, tag) then
-- table.insert(vals,tag)
for _, tag in pairs(node.node.tags or {} ) do
if arrayFindValueIndex(list, tag) == false then
table.insert(list, tag)
@/lua/ge/extensions/ui/gridSelectorUtils/displayDataModule.lua
local function isRecentItem(itemKey)
return arrayFindValueIndex(recentItems, itemKey) or false
end
local function trackRecentItem(itemKey)
local idx = arrayFindValueIndex(recentItems, itemKey)
if idx then
@/lua/ge/extensions/editor/trafficSignalsEditor.lua
if ctrlDefinitionStateName then
selected.ctrlDefState = arrayFindValueIndex(signalCtrlDefinitions.statesSorted, ffi.string(ctrlDefinitionStateName)) or 1
else
if ctrlDefinitionTypeName then
selected.ctrlDefType = arrayFindValueIndex(signalCtrlDefinitions.typesSorted, ffi.string(ctrlDefinitionTypeName)) or 1
else
if not arrayFindValueIndex(currInstance.tempSignalObjects, objId) then
table.insert(currInstance.tempSignalObjects, objId)
@/lua/ge/extensions/flowgraph/nodes/ui/autoMedal.lua
self.pinOut[m].value = true
nextMedal = medals[math.min(arrayFindValueIndex(medals, m) + 1, #medals)]
self.pinOut.nextMedal.value = nextMedal
@/lua/ge/extensions/util/terrainGenerator.lua
local matName = data.internalName or key
if not arrayFindValueIndex(self.materials, matName) then -- prevent duplicates?
if string.find(key, 'TerrainMaterialTextureSet') then
@/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/ge/extensions/gameplay/missions/missionTypes/editorHelper.lua
for _, e in ipairs(hideElementList) do
local idx = arrayFindValueIndex(self.elements, e)
if idx then
@/lua/ge/extensions/freeroam/specialTriggers.lua
if scenetree.objectExistsById(vehId) and be:getObjectActive(vehId) then
if (trigger.subjectIds and arrayFindValueIndex(trigger.subjectIds, vehId)) or
(not trigger.subjectType or trigger.subjectType == 'all') or
@/lua/ge/spawn.lua
for vehId, veh in activeVehiclesIterator() do
if vehId ~= newVehID and not (gameplay_traffic and removeTraffic and arrayFindValueIndex(gameplay_traffic.getTrafficList(), vehId)) then
if intersectingOtherVehicle(veh, axis0, axis1, axis2, halfExtentsX, halfExtentsY, halfExtentsZ, newVehCenter) then
@/lua/ge/extensions/editor/trafficManager.lua
currInstance:linkSignalObject(objId)
if not arrayFindValueIndex(currInstance.tempSignalObjects, objId) then
table.insert(currInstance.tempSignalObjects, objId)
@/lua/ge/extensions/editor/flowgraphEditor.lua
local recentFiles = editor.getPreference("flowgraph.general.recentFiles") or {}
local idx = arrayFindValueIndex(recentFiles, filepath)
if idx then
@/lua/ge/extensions/editor/multiSpawnManager.lua
local tagName = ffi.string(imValues.tagName)
if tagName ~= "" and not arrayFindValueIndex(currGroup.tags, tagName) then
table.insert(currGroup.tags, tagName)
@/lua/ge/extensions/flowgraph/groupHelper.lua
--local childIndex = arrayFindValueIndex(oldGraph.children, oldNode.targetGraph)
--table.remove(oldGraph.children, childIndex)
@/lua/ge/extensions/core/vehicleActivePooling.lua
local count = 0
local filterParked = not vehTypes or arrayFindValueIndex(vehTypes, "PropParked")
for _, veh in ipairs(getAllVehiclesByType(vehTypes)) do -- if vehTypes is nil, uses default args
local result = arrayFindValueIndex(self.activeVehs, vehId)
local state
else
result = arrayFindValueIndex(self.inactiveVehs, vehId)
if result then
if activate then
table.remove(self.inactiveVehs, arrayFindValueIndex(self.inactiveVehs, vehId))
table.insert(self.activeVehs, vehId)
else
table.remove(self.activeVehs, arrayFindValueIndex(self.activeVehs, vehId))
table.insert(self.inactiveVehs, vehId)
@/lua/ge/extensions/editor/util/vehicleSelectUtil.lua
local cType = self.configs[i].Type
if (bList and bList[self.configs[i].key]) or (cType and not arrayFindValueIndex(self.allowedSubtypes or {}, cType)) then
table.remove(self.configs, i)
@/lua/ge/extensions/editor/fileDialog.lua
if im.MenuItem1("Remove current path") then
table.remove(favs, arrayFindValueIndex(favs, currentPath))
table.sort(favs)
@/lua/ge/extensions/flowgraph/nodes/macro/integrated.lua
if self.graph.type == 'macro' then
--local pos = arrayFindValueIndex(self.graph.children, self.targetGraph)
--self.mgr:selectGraph(self.mgr.recentInstance.children[pos])
@/lua/ge/extensions/editor/util/editorElementHelper.lua
for _, e in ipairs(hideElementList) do
local idx = arrayFindValueIndex(self.elements, e)
if idx then
@/lua/ge/ge_utils.lua
local model = core_vehicles.getModel(veh.jbeam).model
if arrayFindValueIndex(typeList, model.Type) then
table.insert(res, veh)
@/lua/ge/extensions/gameplay/parking.lua
if parkedVehData[id] then
table.remove(parkedVehIds, arrayFindValueIndex(parkedVehIds, id))
if sites and parkedVehData[id].parkingSpotId then
@/lua/ge/extensions/flowgraph/manager.lua
for id, list in pairs(map) do
if arrayFindValueIndex(list, res) then
table.remove(list, arrayFindValueIndex(list, res))
if arrayFindValueIndex(list, res) then
table.remove(list, arrayFindValueIndex(list, res))
end
@/lua/ge/extensions/gameplay/sites/customFields.lua
self.values[name] = nil
local idx = arrayFindValueIndex(self.names, name)
table.remove(self.names, idx)