tableFindKey
Definition
-- @/lua/common/utils.lua:739
-- finds the key of a certain value. Non-recursive
function tableFindKey(t, element)
for k, v in pairs(t) do
if v == element then
return k
end
end
end
Callers
@/lua/ge/extensions/campaign/campaigns.lua
if tableFindKey(scenarioData.endOptions, "retry") then
table.insert(sc.stats.buttons, {label='ui.common.retry', cmd='scenario_scenarios.uiEventRetry()', active = defaultToRetry} )
if not sc.result.failed and tableFindKey(scenarioData.endOptions, "next") then
table.insert(sc.stats.buttons, {label='ui.common.next', cmd='campaign_campaigns.uiEventNext()', active = defaultContinue, showLoadingScreen = true, enableOnChooseReward = rewardSelectionRequired} )
table.insert(sc.stats.buttons, {label='ui.common.next', cmd='campaign_campaigns.uiEventNext()', active = defaultContinue, showLoadingScreen = true, enableOnChooseReward = rewardSelectionRequired} )
elseif sc.result.failed and tableFindKey(scenarioData.endOptions, "cancel") then
table.insert(sc.stats.buttons, {label='ui.common.cancel', cmd='campaign_campaigns.uiEventCancel()', active = defaultContinue, showLoadingScreen = true, enableOnChooseReward = rewardSelectionRequired} )
if tableFindKey(scenarioData.endOptions, "menu") then
table.insert(sc.stats.buttons, {label='ui.common.menu', cmd='openMenu'} )
if tableFindKey(scenarioData.endOptions, "freeroam") then
table.insert(sc.stats.buttons, {label='ui.scenarios.end.freeroam', cmd='scenario_scenarios.uiEventFreeRoam()'} )
@/lua/ge/extensions/core/gamestate.lua
local cmdArgs = Engine.getStartingArgs()
local noUiMode = tableFindKey(cmdArgs, '-noui') -- or tableFindKey(cmdArgs, '-headless') -headless is working differenly than expected and should not be used
local cmdArgs = Engine.getStartingArgs()
local noUiMode = tableFindKey(cmdArgs, '-noui') -- or tableFindKey(cmdArgs, '-headless') -headless is working differenly than expected and should not be used
@/lua/ge/extensions/core/input/vehicleSwitching.lua
local currentId = be:getPlayerVehicleID(player)
local currentIndex = tableFindKey(vehicleOrder, currentId) or lastIndex
if currentIndex ~= -1 then
@/lua/ge/extensions/flowgraph/variableStorage.lua
if not self.variables[name] then return end
local oldIdx = tableFindKey(self.customVariableOrder, name)
if oldIdx < newIdx then
self:refreshSortedVariableNames()
local customOrderIndex = tableFindKey(self.customVariableOrder, name)
if customOrderIndex then
-- remove previous name from order table
local customOrderIndex = tableFindKey(self.customVariableOrder, name)
if customOrderIndex then
@/lua/ge/extensions/career/modules/tether.lua
local function removeTether(t)
table.remove(tethers, tableFindKey(tethers, t))
end
@/lua/ge/extensions/core/camera.lua
for camMode,constructor in pairs(getConstructors()) do
if tableFindKey(multicams, camMode) then
local jbeamConfigs = vmcd[camMode] or {}
@/lua/common/utils.lua
function tableContains(t, element)
return tableFindKey(t, element) ~= nil
end
@/lua/ge/extensions/core/vehicle/manager.lua
local profileVehicleLoading = tableFindKey(Engine.getStartingArgs(), '-profileVehicleLoading')
@/lua/ge/extensions/util/compileMeshes.lua
local cmdArgs = Engine.getStartingArgs()
if tableFindKey(cmdArgs, '-compileMeshesNoCache') then
cacheDir = nil
if tableFindKey(cmdArgs, '-compileMeshesNoCompileOnlyCheck') then
log('I', 'work', '*** Will not compile, only check that all DAEs has corresponding CDAEs already compiled, since ran with -compileMeshesNoCompileOnlyCheck')
if tableFindKey(cmdArgs, '-compileMeshesScanPathBaseDirs') then
table.insert(dirs, baseDir)
if tableFindKey(cmdArgs, '-compileMeshesNoCompileOnlyCheck') then
if FS:fileExists(dst) then
if tableFindKey(cmdArgs, '-compileMeshesNoCheck') then
log('I', 'work', '*** Skip checking for missing compile results due to -compileMeshesNoCheck argument.')
@/lua/ge/extensions/flowgraph/nodes/mission/ARunForLife.lua
table.insert(inactiveProps, props[i])
table.remove(activeProps, tableFindKey(activeProps, props[i]))
end
table.insert(activeProps, randomPropId)
table.remove(inactiveProps, tableFindKey(inactiveProps, randomPropId))
table.remove(listLaneDone, tableFindKey(listLaneDone, randomLanePos))
end
@/lua/ge/extensions/editor/missionEditor/objectives.lua
starSet = starSet or act
local slot = tableFindKey(self.mission.careerSetup.defaultStarKeys, key)
if act and slot then
local currentSlot = 'Bonus Star'
local idx = tableFindKey(self.mission.careerSetup.defaultStarKeys, key)
if idx then
for idx, key in ipairs(self.starKeysSorted) do
if self.mission.careerSetup.starsActive[key] and not tableFindKey(self.mission.careerSetup.defaultStarKeys, key) then
table.insert(bonusStars,key)
sums.all[re.attributeKey] = (sums.all[re.attributeKey] or 0) + re.rewardAmount
if tableFindKey(self.mission.careerSetup.defaultStarKeys, key) then
sums.defaultOnly[re.attributeKey] = (sums.defaultOnly[re.attributeKey] or 0) + re.rewardAmount
end
if tableFindKey(bonusStars, key) then
sums.bonusOnly[re.attributeKey] = (sums.bonusOnly[re.attributeKey] or 0) + re.rewardAmount
@/lua/ge/main.lua
doStartupProfiling = tableFindKey(cmdArgs, '-startupProfiling')
if not shipping_build and doStartupProfiling and simpleProfilerStart and profilerPushEvent and profilerPopEvent then
-- optimization for shipping builds: disable profiling if -profiling is not set
local profilingEnabled = tableFindKey(cmdArgs, '-profiling')
if shipping_build and not profilingEnabled then
local _isSafeMode = tableFindKey(cmdArgs, '-safemode')
function isSafeMode()
local function handleCommandLineFirstFrame()
if tableFindKey(cmdArgs, '-flowgraph') then
if getMissionFilename() == "" then
if tableFindKey(cmdArgs, '-compilemeshes') then
extensions.load('util_compileMeshes')
if tableFindKey(cmdArgs, '-LoadSingleLevelForTextureCache') then
--Using existing extension to run level for 600 frames. Use with param: -testlevel [level name]
end
if tableFindKey(cmdArgs, '-LoadSingleLevelForShaderCache') then
--Same but waiting for 2000 frames and 35sec(which happen latest). Usage: -testlevel [level name] -testvehicle [vehicle_name] -testsettings [path to json]
end
if tableFindKey(cmdArgs, '-LoadTrackBuilder') then
extensions.load('test_runTrackBuilder')
end
if tableFindKey(cmdArgs, '-LoadLightRunner') then
extensions.load('test_runLightRunner')
if tableFindKey(cmdArgs, '-convertCSMaterials') then
local function resaveCSFiles(pattern, fnSuffix)
if tableFindKey(cmdArgs, '-deps') then
extensions.util_dependencyTree.test()
if tableFindKey(cmdArgs, '-disableDynamicCollision') then
settings.setValue('disableDynamicCollision', true)
-- we cannot wait for the UI to be ready if it doesn't exist
if tableFindKey(cmdArgs, '-noui') or headless_mode then
-- -headless is working differenly than expected and should not be used
@/lua/ge/extensions/editor/multiSpawnManager.lua
if im.Selectable1(v, selected) then
options.spawnMode, options.spawnModeValue = tableFindKey(options.spawnModesDict, v), v
end
@/lua/ge/extensions/editor/objectTool.lua
if isSel then
local key = tableFindKey(hiddenObjectIconClasses, classes[k])
table.remove(hiddenObjectIconClasses, key)
@/lua/common/jbeam/loader.lua
if Engine.getStartingArgs then
local debugVehicleLoading = tableFindKey(Engine.getStartingArgs(), '-debugVehicleLoading')
end
@/lua/ge/extensions/gameplay/drift/general.lua
local presetPtr = im.IntPtr((tableFindKey(contextList, context)) - 1)
if im.Combo2("", presetPtr, s) then
presetPtr = im.IntPtr((tableFindKey(challengeModeList, challengeMode)) - 1)
if im.Combo2("##"..'t', presetPtr, s) then
@/lua/ge/extensions/career/modules/insurance/insurance.lua
for coverageOptionName, coverageOptionValue in pairs(changedCoverageOptions) do
local coverageOptionValueIndex = tableFindKey(availableInsurances[invVehs[invVehId].insuranceId].coverageOptions[coverageOptionName].changeability.changeParams.choices, coverageOptionValue)
@/lua/ge/client/init.lua
local cmdArgs = Engine.getStartingArgs()
if tableFindKey(cmdArgs, '-noui') then
-- -headless is working differenly than expected and should not be used
if not tableFindKey(cmdArgs, '-convertCSMaterials') then
loadDirRec("core/art/datablocks/")
@/lua/ge/extensions/editor/inspector.lua
if field.useCount == tableSize(valueInspector.selectedIds) then
if nil == tableFindKey(commonFields, fldName) then
commonFields[fldName] = field
@/lua/ge/extensions/editor/slotTrafficEditor.lua
editor.selection.stNode[id] = nil
table.remove(nodesToLinkTo, tableFindKey(nodesToLinkTo, id))
else
@/lua/ge/extensions/campaign/photoSafari.lua
if data.event == 'enter' then
if tableFindKey(hintTriggers,data.triggerName) and not tableFindKey(seen,data.triggerName) then
if next(seen) == nil then
if data.event == 'enter' then
if tableFindKey(hintTriggers,data.triggerName) and not tableFindKey(seen,data.triggerName) then
if next(seen) == nil then
end
if tableFindKey(M.photoSafarimissions, data.triggerName) then
if not (scenetree.findObject(M.photoSafariData[data.triggerName].objectName)) then
@/lua/ge/extensions/statistics/statistics.lua
for k,v in pairs(statData) do
if not tableFindKey(ignoreInstanceFields, k) then
instance[k] = v
@/lua/ge/extensions/editor/fileDialog.lua
-- Add path to recent dirs
local index = tableFindKey(recentDirs, currentPath)
if index then
@/lua/ge/extensions/editor/driftDataEditor.lua
-- the Combo2 needs a intPtr for the current chosen option
local presetPtr = im.IntPtr((tableFindKey(stuntZonePreset.presets, elem.score) or 2) - 1)
if im.Combo2(stuntZonePreset.absolute and "Points" or "Max points", presetPtr, s) then