VE Lua Documentation

Press F to search!

startswith

Definition


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

function string.startswith(String,Start)
  return string.sub(String,1,string.len(Start))==Start
end

Callers

@/lua/ge/extensions/editor/missionEditor.lua
            for _, funName in ipairs(sortedFunctions) do
              if string.startswith(funName, "customFunction") then
                if im.MenuItem1(funName) then
@/lua/ge/extensions/scenario/raceGoals.lua
          if type(val) == "string" then
            if not string.startswith(val, "scenarios.") then
              log("W", "", "Possible missing localization for '"..dumps(gkey).."' in scenario goal: "..dumps(val))
@/lua/ge/extensions/editor/dynamicDecalsTool.lua
  for _, dependency in ipairs(M.dependencies) do
    if string.startswith(dependency, "editor_dynamicDecals") then
      local file = getDependencyFile(dependency)
  for _, dependency in ipairs(M.dependencies) do
    if string.startswith(dependency, "editor_dynamicDecals") and extensions[dependency].editorPreferenceValueChanged then
      extensions[dependency].editorPreferenceValueChanged(path, value)
  for _, dependency in ipairs(M.dependencies) do
    if string.startswith(dependency, "editor_dynamicDecals") and extensions[dependency].registerEditorPreferences then
      extensions[dependency].registerEditorPreferences(prefsRegistry)
@/lua/ge/extensions/ui/uiMods.lua
  for _,v in pairs(files) do
    if not modModulesChanged and string.startswith(v.filename, "/ui/modModules/") then
      sendUIModules()
    end
    if not vueModsChanged and string.startswith(v.filename, "/ui/ui-vue/mods/") then
      guihooks.trigger("UiModsChanged")
@/lua/ge/extensions/core/quickAccess.lua
  if args.desc == nil then args.desc = '' end
  if not (string.startswith(args.level, "/root/")) then
    args.level = '/root/sandbox' .. args.level
@/lua/ge/extensions/editor/util/editorElementHelper.lua
    for _, key in pairs(sortedKeys) do
      if key ~= "fieldName" and string.startswith(key, "fieldName") then
        customFnCount = customFnCount+1
      for _, key in pairs(sortedKeys) do
        if key ~= "fieldName" and string.startswith(key, "fieldName") then
          table.insert(ret, {label = string.sub(key, 10), fieldName = elem[key], elemLabel = elem.label})
@/lua/ge/extensions/util/compileMeshes.lua
  for _,i in ipairs(ignorePath)do
    if string.startswith(filepath, i) then return true end
  end
@/lua/ge/extensions/core/input/actions.lua
    local prefix = vehicleName.."__"
    if string.startswith(actionName, prefix) then
      actionName = string.sub(actionName, 1+string.len(prefix))
      -- catalog menu vs non-menu actionmaps
      local isMenuAction = string.startswith(actionMap, M.menuIndependentPrefix)
      if isMenuAction then M.menuActionMapNames[actionMap] = true end
local function onFileChanged(filename)
  local actionsModified = string.startswith(filename, "/lua/ge/extensions/core/input/actions") and string.endswith(filename, ".json")
  if actionsModified then
@/lua/ge/extensions/editor/audioEventsList.lua
    local pathSplit = nil
    if not string.startswith(eventName, "event:>") then
      if not eventObj.getSoundFilename then
@/lua/ge/extensions/ui/liveryEditor.lua
  for _, dependency in ipairs(M.dependencies) do
    if string.startswith(dependency, "ui_liveryEditor_") then
      extensions[dependency].setup()
@/lua/vehicle/controller/drivingDynamics/CMU.lua
  for _, sub in ipairs(subControllers) do
    if sub.typeName:startswith(path) then
      table.insert(subs, sub)
@/lua/ge/extensions/core/camera.lua
local function onFileChanged(filePath, changeType)
  if (changeType == "added" or changeType == "deleted") and string.startswith(filePath, '/lua/ge/extensions/core/cameraModes/') then
    invalidateCaches()
@/lua/ge/extensions/scenario/scenariosLoader.lua
      for _, p in pairs(tmp) do
        if string.startswith(p, scenarioData.directory) then
          local imageFilename = string.sub(p, string.len(scenarioData.directory) + 2, string.len(p) - 4)
@/lua/ge/extensions/trackbuilder/trackBuilder.lua
local function meshNameToIndex(name)
  if not string.startswith(name,"procMesh") then return -1,-1 end
  local dashIndex = string.find(name,"-")
      elseif mergeMode == 'delete' then
        if string.startswith(res.object:getName(),"procMerger") then
          tb.removeIntersection(res.object:getName())
local function obstacleNameToIndex(name)
  if not string.startswith(name,"procObstacle") then return -1,-1 end
  local dashIndex = string.find(name,"x")
          paintObstacle(index,sub,doFill,pipette)
        elseif string.startswith(res.object:getName(),"procMerger") then
          paintIntersection(res.object:getName())
        setSegmentMesh(index, sub, doFill, pipette)
      elseif string.startswith(res.object:getName(),"procMerger") then
        setIntersectionMesh(res.object:getName())
@/lua/common/extensions/ui/flowgraph/editor.lua
  if string.endswith(n, "pos") or
          string.startswith(n, "pos") or
          string.endswith(n, "scl") or
          string.endswith(n, "scl") or
          string.startswith(n, "scl") or
          string.endswith(n, "vec") or
          string.endswith(n, "vec") or
          string.startswith(n, "vec") or
          string.endswith(n, "vec3") or
          string.endswith(n, "vec3") or
          string.startswith(n, "vec3") or
          string.find(n, "position") or
  string.endswith(n, "rot") or
          string.startswith(n, "rot") or
          string.endswith(n, "quat") or
          string.endswith(n, "quat") or
          string.startswith(n, "quat") or
          string.find(n, "rotation") or
  string.endswith(n, "clr") or
          string.startswith(n, "clr") or
          string.find(n, "color")
  string.endswith(n, "num") or
          string.startswith(n, "num") or
          string.endswith(n, "id") or
          string.find(n, "contains") or
          string.startswith(n, "has") or
          string.startswith(n, "uses") or
          string.startswith(n, "has") or
          string.startswith(n, "uses") or
          string.startswith(n, "with")
          string.startswith(n, "uses") or
          string.startswith(n, "with")
  then
@/lua/ge/extensions/util/richPresence.lua
    --log("E","onUiReady",dumps(s))
    if string.startswith(s,"menu.") then
      state = 3 --menu
      end
    elseif string.startswith(s,"scenario-") then
      state = 2 --stagging
  local state = 0 --invalid
  if string.startswith(toState,"menu.") then
    state = 3 --menu
    end
  elseif string.startswith(toState,"scenario-") then
    state = 2 --stagging
@/lua/ge/extensions/gameplay/markerInteraction.lua
  for i, cluster in ipairs(gameplay_playmodeMarkers.getPlaymodeClusters()) do
    if string.startswith(cluster.id, "missionMarker") then
      cluster.focus = false
@/lua/ge/extensions/gameplay/rally/driveline/drivelineRoute.lua
    if point.metadata.racePathnodeType then
      if string.startswith(point.metadata.racePathnodeType, "split_") or point.metadata.racePathnodeType == "finish" then
        hasSplitLabel = true
@/lua/ge/extensions/core/levels.lua
    local filename = v.filename
    if string.startswith(filename, '/levels/') then
      -- dump{'onFileChanged: invalidating level cache', filename, type}
@/lua/ge/extensions/core/schemeCommandServer.lua

    if string.startswith(data, 'beamng:') then
        commandhandler.onSchemeCommand(data:sub(8))
@/lua/ge/extensions/core/modmanager.lua
  for _, path in ipairs(files) do
    if string.startswith(path, "/vehicles/") and not string.startswith(path, "/vehicles/mod_info") then
    vehicles[string.sub(path, 20)] = 1
  for _, path in ipairs(files) do
    if string.startswith(path, "/vehicles/") and not string.startswith(path, "/vehicles/mod_info") then
    vehicles[string.sub(path, 20)] = 1
  -- fix old bug in db
  if M.modIsUnpacked(modname) and filename:find('/unpacked/') and mods[modname].orgZipFilename:startswith('/mods') and not mods[modname].orgZipFilename:startswith('/mods/') then
    mods[modname].orgZipFilename = mods[modname].orgZipFilename:gsub('/mods', '/mods/')
  -- fix old bug in db
  if M.modIsUnpacked(modname) and filename:find('/unpacked/') and mods[modname].orgZipFilename:startswith('/mods') and not mods[modname].orgZipFilename:startswith('/mods/') then
    mods[modname].orgZipFilename = mods[modname].orgZipFilename:gsub('/mods', '/mods/')
local function safeDelete(filename)
  if not string.startswith(filename, '/mods/') or filename:find("%.%.") ~= nil then
    log('E', 'safeDelete', 'unable to delete file: not in mods folder: ' .. filename)
      local fp = "/" .. _cleanPathFromHash(e[1]) --e[2] is hash
      if (string.startswith(fp,'/scripts/') or string.startswith(fp,'/mods_data/'))
      and string.endswith(fp,'/modScript.lua') then
      local fp = "/" .. _cleanPathFromHash(e[1]) --e[2] is hash
      if (string.startswith(fp,'/scripts/') or string.startswith(fp,'/mods_data/'))
      and string.endswith(fp,'/modScript.lua') then
      for k,v in ipairs(filesInZIP) do
        if (string.startswith(v,'/scripts/') or string.startswith(v,'/mods_data/'))
        and string.endswith(v,'/modScript.lua') then
      for k,v in ipairs(filesInZIP) do
        if (string.startswith(v,'/scripts/') or string.startswith(v,'/mods_data/'))
        and string.endswith(v,'/modScript.lua') then
    -- copy only files
    if zipPath:startswith(mods[modname].unpackedPath) then
      zipPath = string.sub(zipPath, string.len(mods[modname].unpackedPath) + 1)
      zipPath = string.sub(zipPath, string.len(mods[modname].unpackedPath) + 1)
      if string.startswith(zipPath, '/') then
        zipPath = string.sub(zipPath, 2)
local function onFileChanged(filename, type)
  if filename:startswith("/mods/unpacked") then return end
  if filename:startswith("/mods/") and filename:endswith(".zip") and filename ~= persistencyfile and autoMount then
  if filename:startswith("/mods/unpacked") then return end
  if filename:startswith("/mods/") and filename:endswith(".zip") and filename ~= persistencyfile and autoMount then
    workOffChangedMod(filename, type)
  local realPath = FS:getFileRealPath(filename_virtual)
  if string.startswith(realPath, gamePath) then
    -- no mods allowed in game path
  end
  if string.startswith(realPath, userPath) then
    local modPath = realPath:sub(string.len(userPath))
@/lua/ge/extensions/gameplay/missions/missionTypes/editorHelper.lua
    for _, key in pairs(sortedKeys) do
      if key ~= "fieldName" and string.startswith(key, "fieldName") then
        customFnCount = customFnCount+1
      for _, key in pairs(sortedKeys) do
        if key ~= "fieldName" and string.startswith(key, "fieldName") then
          table.insert(ret, {label = string.sub(key, 10), fieldName = elem[key], elemLabel = elem.label})
@/lua/ge/ge_utils.lua
function isOfficialContent(path)
  return string.startswith(path, FS:getGamePath())
end
function isOfficialContentVPath(vpath)
  return string.startswith(FS:getFileRealPath(vpath), FS:getGamePath())
end
  if not shipping_build and FS:getGamePath() == FS:getUserPath() then return false end --make sure you don't delete official config
  return string.startswith(FS:getFileRealPath(vpath), FS:getUserPath().."vehicles"..osSep) and string.endswith(vpath, ".pc")
end
@/gameplay/missions/italy/arrive/012-Field/script.lua

      if n1 and n2 and (string.startswith(n1, self.str) or string.startswith(n2, self.str)) then
        veh:queueLuaCommand("ai.setAggression(0.4)") -- sets AI aggression to a low value, to assist with difficult turn

      if n1 and n2 and (string.startswith(n1, self.str) or string.startswith(n2, self.str)) then
        veh:queueLuaCommand("ai.setAggression(0.4)") -- sets AI aggression to a low value, to assist with difficult turn
@/lua/ge/extensions/editor/materialEditor.lua
  if not p or p == "" then return "", "" end
  local isTag = string.startswith(p, '@') or string.startswith(p, '^')
  if isTag then return p, p end
  if not p or p == "" then return "", "" end
  local isTag = string.startswith(p, '@') or string.startswith(p, '^')
  if isTag then return p, p end
          local _, abs = normalizePathForCheck(mat, raw)
          local isTagged = string.startswith(raw, "@") or string.startswith(raw, "^")
          if not isTagged and abs and abs ~= "" and not seen[abs] then
          local _, abs = normalizePathForCheck(mat, raw)
          local isTagged = string.startswith(raw, "@") or string.startswith(raw, "^")
          if not isTagged and abs and abs ~= "" and not seen[abs] then
          local lower = string.lower(rel)
          local isTagged = string.startswith(raw, "@") or string.startswith(raw, "^")
          if not isTagged and not string.find(rel, "/", 1, true) then
          local lower = string.lower(rel)
          local isTagged = string.startswith(raw, "@") or string.startswith(raw, "^")
          if not isTagged and not string.find(rel, "/", 1, true) then
          if isVehicleMat and not isTagged then
            if not (string.startswith(lower, "vehicles/") or string.startswith(lower, "/vehicles/")) then
              pushIssue(key, 1, "Non-vehicle texture mapped in a vehicle material: " .. rel)
          if isVehicleMat and not isTagged then
            if not (string.startswith(lower, "vehicles/") or string.startswith(lower, "/vehicles/")) then
              pushIssue(key, 1, "Non-vehicle texture mapped in a vehicle material: " .. rel)
  local p = res
  if not string.startswith(p or '', '/') and FS:fileExists('/'..(p or '')) then
    p = '/'..p
    if im.ImGuiTextFilter_PassFilter(matFilter, v) and v then
      if options and options.textFilterResultsWithSameFirstCharAtTop == true and #textFilterString > 0 and string.startswith(string.lower(v), textFilterString) then
        table.insert(sortedMaterialObjectNamesAtTop, v)
  local absPath = imgPath
  local isTaggedTexture = string.startswith(imgPath, '@')
  local isLevelRelativeTexture = string.startswith(imgPath, '^')
  local isTaggedTexture = string.startswith(imgPath, '@')
  local isLevelRelativeTexture = string.startswith(imgPath, '^')
@/lua/ge/extensions/freeroam/vueBigMap.lua
    for _, groupId in ipairs(sortedGroupIds) do
      if string.startswith(groupId, 'missionType_') then
        table.insert(groupStructure[2].groups, groupsById[groupId])
@/lua/ge/extensions/gameplay/traffic/baseRole.lua
          -- this could be better...
          if string.startswith(ctrlState.state, 'green') then
            sequence:advance()
            break
          elseif string.startswith(ctrlState.state, 'yellow') then
            freeze = false
            freeze = false
          elseif string.startswith(ctrlState.state, 'red') then
            valid = true
@/lua/ge/extensions/editor/api/dynamicDecals.lua
        local value = mat:getField("baseColorMap", stage)
        if value and value ~= "" and value:startswith("@DynamicTexture") then
          mat:setField("baseColorMap", stage, directory .. skinName .. "_d.data.png")
        -- value = mat:getField("normalMap", stage)
        -- if value ~= "" and value:startswith("@DynamicTexture") then
        --   mat:setField("normalMap", stage, directory .. skinName .. "_n.normal.png")
        value = mat:getField("metallicMap", stage)
        if value and value ~= "" and value:startswith("@DynamicTexture") then
          mat:setField("metallicMap", stage, directory .. skinName .. "_m.data.png")
        value = mat:getField("roughnessMap", stage)
        if value and value ~= "" and value:startswith("@DynamicTexture") then
          mat:setField("roughnessMap", stage, directory .. skinName .. "_r.data.png")
        value = mat:getField("colorPaletteMap", stage)
        if value and value ~= "" and value:startswith("@DynamicTexture") then
          mat:setField("colorPaletteMap", stage, directory .. skinName .. "_cp.data.png")
@/lua/ge/extensions/core/multiseat.lua
  for _,devname in ipairs(devnames) do
    if devname:startswith("keyboard") or devname:startswith("mouse") then
      result[devname] = 0
  for _,devname in ipairs(devnames) do
    if devname:startswith("keyboard") or devname:startswith("mouse") then
      result[devname] = 0
@/lua/ge/extensions/freeroam/bigMapPoiProvider.lua
  for _, groupKey in ipairs(tableKeysSorted(groupData)) do
    if string.startswith(groupKey,'missionType_') then
      table.insert(filterMissionsByType.groups, groupData[groupKey])
@/lua/ge/extensions/core/vehicle/mirror.lua
  local configName = veh.partConfig or "default"
  if configName:startswith("{") then --custom
    configName = "custom" -- +"_"+stringHash(configName)
  local configName = veh.partConfig or "default"
  if configName:startswith("{") then --custom
    configName = "custom" -- +"_"+stringHash(configName)
@/lua/ge/extensions/ui/apps.lua
    local filename = v.filename
    if string.startswith(filename, appsDir) or string.startswith(filename, '/mods/') then
      requestUIAppsData()
    local filename = v.filename
    if string.startswith(filename, appsDir) or string.startswith(filename, '/mods/') then
      requestUIAppsData()
@/lua/ge/extensions/editor/multiSpawnManager.lua

      if string.startswith(updateReason, "paint") and currGroupData[updateReason] == "(Custom)" then
        options.colorPickerData = nil
@/lua/ge/main.lua

  if not FS:directoryExists("trackEditor") or not string.startswith(FS:getFileRealPath("trackEditor"), FS:getUserPath())  then FS:directoryCreate("trackEditor") end
end
@/lua/ge/extensions/editor/resourceChecker.lua
      else
        if not string.startswith(res, '/') then
          res = '/'..res
      if not type then
        if not string.startswith(res, '/') then
          res = '/'..res
      if im.Selectable1("Copy path to clipboard##"..res..count) then
        if not string.startswith(res, '/') then
          res = '/'..res
      if im.Selectable1("Dump asset##"..res..count) then
        if not string.startswith(res, '/') then
          res = '/'..res
                            local path = o:match("^(%S+)%s+(.+)")
                            if not string.startswith(path, '/') then
                              path = '/'..path
        end
        if not string.startswith(path, '/') then
          path = '/'..path
@/lua/ge/extensions/core/commandhandler.lua
      arg1 = arg1:stripcharsFrontBack('"\'')
      if arg1:startswith('beamng:') then
        onSchemeCommand(arg1:sub(8), true) -- strip 'beamng:'
@/lua/ge/extensions/core/input/bindings.lua
      end
      if string.startswith(device, "xinput") then
        local n = string.sub(device, -1, -1) -- get controller number (xinput3 -> 3)
      log("I", "bindings", msg.." ("..device.."/0x"..pidvid..")")
      if string.startswith(device, "xinput") then
        local n = string.sub(device, -1, -1) -- get controller number (xinput3 -> 3)
  actionMapName = actionMapName or prefix..actionName.."ActionMap"
  local isMenuIndependent = string.startswith(actionMapName, prefix)
  local isMenuActionMap = isMenuIndependent or (actionMapName == "MenuActionMap")
local function onFileChanged(filename, t)
  local actionsModified = string.startswith(filename, "/lua/ge/extensions/core/input/actions") and string.endswith(filename, "json")
  local bindingsModified = string.startswith(filename, "/settings/inputmaps/")
  local actionsModified = string.startswith(filename, "/lua/ge/extensions/core/input/actions") and string.endswith(filename, "json")
  local bindingsModified = string.startswith(filename, "/settings/inputmaps/")
  if actionsModified or bindingsModified then
@/lua/ge/extensions/career/modules/delivery/cargoCards.lua
  for key, group in pairs(groupsByKey) do
    if key ~= "destination_noDestination" and key:startswith('destination_') then
      table.insert(destinationGroups, group)
    for key, group in pairs(groupsByKey) do
      if key:startswith('task_') then
        group.showEmpty = true
@/lua/ge/extensions/ui/uiNavi.lua
    local minimapImage = terr.minimapImage -- minimapImage is a BString
    if minimapImage:startswith("/") then
      minimapImage = minimapImage:sub(2)
@/lua/ge/extensions/gameplay/missions/missions.lua
local function loadMission(missionDir)
  if not string.startswith(missionDir, missionsDir) then
    log("E", "", "Unable to load mission, not placed in "..missionsDir..": "..dumps(missionDir))
@/lua/ge/extensions/core/vehicles.lua
local function _isOfficialContentVPathFast(vpath)
  return string.startswith(FS:getFileRealPath(vpath), _cachedGamePath)
end
@/lua/ge/extensions/editor/shapeEditor.lua
    local data = readFile(mcf)
    if not string.startswith(data,"//JSON:") then
      log("E","_readMeshConstructor","no lua metadata!!")
@/lua/vehicle/extensions/core/quickAccess.lua

  if not (string.startswith(args.level, "/root/playerVehicle/") or string.startswith(args.level, "/root/sandbox/")) then
    args.level = "/root/playerVehicle" .. args.level

  if not (string.startswith(args.level, "/root/playerVehicle/") or string.startswith(args.level, "/root/sandbox/")) then
    args.level = "/root/playerVehicle" .. args.level
@/lua/ge/extensions/flowgraph/modules/prefabModule.lua
          if k == "BeamNGVehicle" then
            if string.startswith(name, "clone") then
              log("W", "prefabModule", "Prefab BeamNGVehicle object with Name value starting with 'clone': "..dumps(name).."; to prevent conflicts, please rename this to something else.")
@/lua/ge/extensions/campaign/campaigns.lua
    local scenarioPath = location.path
    if not string.startswith(scenarioPath, "/") then
      scenarioPath = "/"..location.path
@/lua/ge/extensions/editor/dynamicDecals/textures.lua
  -- Filter out all files that start with an underscore.
  if fileName:startswith("_") then
    return false
@/lua/ge/extensions/editor/api/dynamicDecals/textures.lua
  local dir, filename, ext = path.split(filepath)
  if string.startswith(dir, texturesDirectoryPath) and (ext == "png" or ext == "jpg") then
    if type == 'added' or type == 'modified' then
@/lua/ge/extensions/editor/trafficSignalsEditor.lua
  for _, otherInstance in ipairs(instances) do
    if instance.id ~= otherInstance.id and string.startswith(otherInstance.name, name) then
      local num = string.gsub(otherInstance.name, name, "")
              for k, c in pairs(imColors) do
                if string.startswith(state.state, k) then -- can be green, yellow, or red
                  color = c