GE Lua Documentation

Press F to search!

extractBranchPathIdFromFilePath

Definition


-- @/lua/ge/extensions/career/branches.lua:620

local function extractBranchPathIdFromFilePath(filePath)
  -- Get the directory path without the file name
  local infoDir, _, _ = path.split(filePath)

  -- Extracting folders
  local folders = {'domains'}
  for folder in string.gmatch(string.sub(infoDir, #branchesDir, -2), "[^/]+") do
      table.insert(folders, folder)
  end

  -- Build path ID from folders, excluding type names
  local pathId = ""
  local skipFolders = {domains = true, branches = true, skills = true}
  for _, folder in ipairs(folders) do
    if not skipFolders[folder] then
      if pathId ~= "" then
        pathId = pathId .. "-"
      end
      pathId = pathId .. folder
    end
  end

  return pathId
end

Callers

@/lua/ge/extensions/career/modules/branches/leagues.lua

            league.skillPathId = career_branches.extractBranchPathIdFromFilePath(file)
            local skill = career_branches.getBranchById(league.skillPathId)