VE Lua Documentation

Press F to search!

endswith

Definition


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

function string.endswith(String,End)
  return End=='' or string.sub(String,-string.len(End))==End
end

Callers

@/lua/ge/extensions/ui/vehicleSelector/tileClustering.lua
  for _, source in ipairs(sources) do
    if string.endswith(source, ".svg") then
      table.insert(sourceIcons, {svg = source})
  for _, source in ipairs(sources) do
    if string.endswith(source, ".svg") then
      table.insert(sourceIcons, {svg = source})
@/lua/ge/extensions/gameplay/missions/missionTypes/flowMission.lua
        end
        if not string.endswith(vehModelConfig, " ") then
          vehModelConfig = vehModelConfig.." "
            end
            if not string.endswith(vehModelConfig, " ") then
              vehModelConfig = vehModelConfig.." "
@/lua/ge/extensions/gameplay/traffic/vehicle.lua
    role = 'police'
  elseif string.endswith(pc, '.pc') and string.find(pc, 'police') then -- assumes police vehicle
    role = 'police'
@/gameplay/missions/automation_test_track/flowgraph/001-Dam/customNodes/getClosestStaticObjectNode.lua
  local shapeName = self.pinIn.shapeName.value
  if shapeName and not string.endswith(shapeName, ".dae") then
    shapeName = shapeName..".dae"
    if not internalName or internalName == tostring(obj:getInternalName()) then
      if not shapeName or string.endswith(obj.shapeName, shapeName) then
        local sqDist = self.pos:squaredDistance(obj:getPosition())
@/lua/ge/extensions/gameplay/rally/loop/rallyAttempts.lua
      config = veh.partConfig,
      isConfigFile = string.endswith(veh.partConfig, '.pc')
    }
@/lua/ge/extensions/core/input/bindings.lua
    for j,v in ipairs(s) do
      if v.name:endswith("ActionMap") then -- skip the editor (and similar) action maps
        scenetree[v.name]:clear()
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/")
@/lua/ge/extensions/util/export.lua
  local dir, filename, ext = path.splitWithoutExt(filepath)
  if filename:endswith(".dds") then filename = filename:sub(1, -5) end
  for k,v in pairs(gltfCurrentMaterial) do
    if k:endswith("Map") then
      gltfCurrentMaterial[k.."Index"] = {}
@/lua/ge/extensions/career/modules/delivery/progress.lua
      }
      if key:endswith("Reputation") then
        branchInfo[key].order, branchInfo[key].icon = 7000, "peopleOutline" --freeroam_organizations.getOrganizationIdOrderAndIcon()

    if key:endswith("Reputation") then
      local orgId = key:sub(1, -11)
@/lua/ge/extensions/freeroam/freeroamConfigurator.lua
  -- If config ends in .pc, add it to the list
  if config and string.endswith(config, ".pc") and FS:fileExists(config) then
    table.insert(validationFiles, config)
@/lua/ge/extensions/editor/terrainEditor.lua
  end
  if not string.endswith(dir, '/') then
    dir = dir .. '/'
@/lua/ge/extensions/flowgraph/nodes/vehicle/customPartsConfigProvider.lua
    if veh then
      if string.endswith(veh.partConfig, ".pc") then
        im.Text("Part Config File: ")
@/lua/console/resave-pcs.lua
            if not file then break end
            if string.endswith(file, ".pc") then
                if FS:fileExists(vdir.."/"..file) then
@/lua/ge/extensions/util/screenshotCreator.lua

    if not string.endswith(partConfig, ".pc") then
      im.Text("ERROR: Player vehicle does not originate from a part config file (.pc). Please choose a vehicle that does.")
@/lua/ge/extensions/gameplay/missions/missions.lua
  if type(missionData.description) == "string" then
    while string.endswith(missionData.description, "\n") do
      missionData.description = string.sub(missionData.description, 1, -2)
@/lua/ge/extensions/core/modmanager.lua
    mods[modname].dirname, mods[modname].filename = path.split(mods[modname].fullpath)
    if filename:find('/unpacked/') and filename:endswith('/') then
      mods[modname].orgZipFilename = filename:gsub('unpacked/', '')

    if filename:find('/unpacked/') and filename:endswith('/') then
      d.orgZipFilename = filename:gsub('unpacked/', '')
  --if you only have vanila and unpacked, the level list do not get refreshed
  if filename:find('/unpacked/') and filename:endswith('/') then
    if FS:directoryExists(filename.."levels/") then
      uniqueModList[modname] = filepath
      if string.endswith(filepath, ".zip" ) and FS:fileExists(filepath) then
        -- log('D', 'checkDuplicatedMods', "opening zip")
    -- mount only zip files and unpacked zip folders
    if string.endswith(filename, '.zip') or FS:directoryExists(filename) then
      -- check for unpacked mods
      if (string.startswith(fp,'/scripts/') or string.startswith(fp,'/mods_data/'))
      and string.endswith(fp,'/modScript.lua') then
        modScripts[#modScripts+1] = fp
        if (string.startswith(v,'/scripts/') or string.startswith(v,'/mods_data/'))
        and string.endswith(v,'/modScript.lua') then
          modScripts[#modScripts+1] = v
  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)
@/lua/ge/extensions/editor/dynamicDecals/history.lua
  local history = api.getHistory()
  local childHeight = (string.endswith(guiId, "_section")) and editor.getPreference("dynamicDecalsTool.history.sectionHeight") or 0
@/lua/ge/extensions/util/terrainGenerator.lua

  if not string.endswith(path, '.png') then
    path = path..'.png'

  if not string.endswith(path, '.png') then
    path = path..'.png'
  self.userDir = dir or 'temp/'
  if not string.endswith(self.userDir, '/') then self.userDir = self.userDir..'/' end
  if FS:directoryExists(self.userDir) then
@/lua/ge/extensions/career/modules/playerAttributes.lua

    if attributeName:endswith("Reputation") then
      local orgId = attributeName:sub(1, -11)
      for _, key in ipairs(career_branches.orderAttributeKeysByBranchOrder(tableKeys(change.attributeChange))) do
        if key:endswith("Reputation") then
          table.insert(rewards, {attributeKey = "reputation", rewardAmount = change.attributeChange[key], icon="peopleOutline"})
@/lua/ge/extensions/flowgraph/nodes/scene/spawnPrefab.lua
  local checkPaths = {filePath, filePath .. '.prefab', filePath .. '.prefab.json'}
  if string.endswith(filePath, '.prefab') then
    table.insert(checkPaths, filePath .. '.json')
  if succ then
    if string.endswith(file, '.prefab') then
      log("W","","Loading a .prefab file; please upgrade to .prefab.json. " .. dumps(file),{type = "node", node = self})
@/lua/ge/extensions/flowgraph/modules/aiRecordingModule.lua
    config = veh.partConfig,
    isConfigFile = string.endswith(veh.partConfig,'.pc'),
    licensePlate = veh:getDynDataFieldbyName("licenseText", 0) or "",
@/lua/ge/extensions/editor/resourceChecker.lua
local function texHovered(res)
  if res and not FS:fileExists(res) and string.endswith(res, ".png" ) then
    res = string.gsub(res, ".png", ".dds")
                                  end
                                  if string.endswith(txtstring, ", " ) then
                                    local stringend = ", "
@/lua/ge/ge_utils.lua
function spawnPrefab(objName, objFileName, objPos, objRotation, objScale, useGlobalTranslation)
  if string.endswith(objFileName, ".prefab.json") then
    local jsonData = jsonReadFile(objFileName)
  if type(opt.config) == 'string' then
    if string.endswith(opt.config, '.pc') then
      local configName = string.match(opt.config, "([^./]*).pc")
  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
@/lua/ge/extensions/core/input/actions.lua
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/flowgraph/missionVariableHelper.lua
  if mgr.savedDir and mgr.savedFilename then
    if string.endswith(mgr.savedFilename, ".flow.json") then
      mgrPath = mgr.savedDir .. mgr.savedFilename
@/lua/ge/extensions/editor/api/dynamicDecals.lua
        end
        if string.endswith(materialName, "main") then
          mat1 = {k, materialName}
        end
        if string.endswith(materialName, "body") then
          mat2 = {k, materialName}
@/lua/ge/extensions/flowgraph/nodes/activity/attemptVehicle.lua
        config = veh.partConfig,
        isConfigFile = string.endswith(veh.partConfig,'.pc')
      }
@/lua/ge/extensions/ui/gameplaySelector/tileClustering.lua
  for source, active in pairs(sourceIconsLookup) do
    if string.endswith(source, ".svg") then
      table.insert(sourceIcons, {svg = source})
@/lua/ge/extensions/editor/multiSpawnManager.lua
  end
  if vehSelector.config and string.endswith(vehSelector.config, ".pc") then
    vehSelector.customConfigActive = true
@/lua/common/extensions/ui/flowgraph/editor.lua
  local n = string.lower(name)
  if string.endswith(n, "pos") or
          string.startswith(n, "pos") or
          string.startswith(n, "pos") or
          string.endswith(n, "scl") or
          string.startswith(n, "scl") or
          string.startswith(n, "scl") or
          string.endswith(n, "vec") or
          string.startswith(n, "vec") or
          string.startswith(n, "vec") or
          string.endswith(n, "vec3") or
          string.startswith(n, "vec3") or
  elseif
  string.endswith(n, "rot") or
          string.startswith(n, "rot") or
          string.startswith(n, "rot") or
          string.endswith(n, "quat") or
          string.startswith(n, "quat") or
  elseif
  string.endswith(n, "clr") or
          string.startswith(n, "clr") or
  elseif
  string.endswith(n, "num") or
          string.startswith(n, "num") or
          string.startswith(n, "num") or
          string.endswith(n, "id") or
          string.find(n, "number") or
@/lua/ge/extensions/core/vehicle/partmgmt.lua
  local partConfigFilename = vehicle.partConfig
  if partConfigFilename and string.endswith(partConfigFilename, '.pc') then
    -- Vehicle originates from a part config file
@/lua/ge/extensions/editor/trafficManager.lua

  if string.endswith(filePath, ".prefab.json") then -- tries to load the actual data file instead of the prefab
    filePath = filePath:gsub(".prefab.json", ".json")

  if string.endswith(filePath, ".prefab.json") then -- tries to save the actual data file instead of the prefab
    filePath = filePath:gsub(".prefab.json", ".json")
@/lua/ge/extensions/career/modules/delivery/vehicleTasks.lua
  for rewardKey, rewardValue in pairs(originalRewards) do
    if rewardKey:endswith("Reputation") then
      reputationRewards[rewardKey] = rewardValue
@/lua/ge/extensions/core/vehicles.lua
    end
    if not string.endswith(filename, '.pc') then filename = filename .. '.pc' end
    local data = jsonReadFile(filename)
@/lua/ge/extensions/editor/materialEditor.lua

          local isPng = string.endswith(lower, ".png")
          local isDds = string.endswith(lower, ".dds")
          local isPng = string.endswith(lower, ".png")
          local isDds = string.endswith(lower, ".dds")
          local isCookerSuffix =
          local isCookerSuffix =
            string.endswith(lower, ".color.png") or
            string.endswith(lower, ".normal.png") or
            string.endswith(lower, ".color.png") or
            string.endswith(lower, ".normal.png") or
            string.endswith(lower, ".data.png")
            string.endswith(lower, ".normal.png") or
            string.endswith(lower, ".data.png")
          elseif isDds then
            if string.endswith(lower, ".data.dds") or string.endswith(lower, ".color.dds") or string.endswith(lower, ".normal.dds") then
              pushIssue(key, 3, "Mapping uses DDS with texture-cooker suffix (not recookable): " .. rel)
          elseif isDds then
            if string.endswith(lower, ".data.dds") or string.endswith(lower, ".color.dds") or string.endswith(lower, ".normal.dds") then
              pushIssue(key, 3, "Mapping uses DDS with texture-cooker suffix (not recookable): " .. rel)
          elseif isDds then
            if string.endswith(lower, ".data.dds") or string.endswith(lower, ".color.dds") or string.endswith(lower, ".normal.dds") then
              pushIssue(key, 3, "Mapping uses DDS with texture-cooker suffix (not recookable): " .. rel)
@/lua/ge/extensions/ui/vehicleSelector/tiles.lua
  for _, source in ipairs(sources) do
    if string.endswith(source, ".svg") then
      table.insert(sourceIcons, {svg = source})
@/lua/ge/extensions/scenario/scenariosLoader.lua
    for _, prefabPath in ipairs(foundFiles) do
      if string.endswith(prefabPath, ".json") then
        dir, pathScenarioName, ext = path.splitWithoutExt(prefabPath, ".prefab.json")