GE Lua Documentation

Press F to search!

savePath

Definition


-- @/lua/ge/extensions/gameplay/crawl/saveSystem.lua:357

M.savePath = function(path, filePath)
  if not path then
    log('E', logTag, 'No path to save')
    return false
  end

  if not filePath then
    log('E', logTag, 'No file path provided for path')
    return false
  end

  local serializedData = serializePath(path)
  if not serializedData then
    return false
  end

  local dir = string.match(filePath, "^(.*)/[^/]*$")
  if dir then
    FS:directoryCreate(dir)
  end

  local success = jsonWriteFile(filePath, serializedData, true)
  if success then
    -- Update cache
    if not cache.paths then
      cache.paths = {}
    end
    cache.paths[filePath] = path
    return true
  else
    log('E', logTag, 'Failed to save path to: ' .. filePath)
    return false
  end
end

Callers

@/lua/ge/extensions/editor/util/editorElementHelper.lua
          local cedit = editor_camPathEditor
          core_paths.savePath(editor_camPathEditor.currentPath, container.missionFolder .. fl)
        end
@/lua/ge/extensions/editor/crawlEditor.lua
    elseif objectType == "path" then
      gameplay_crawl_saveSystem.savePath(object, newFilePath)
    elseif objectType == "boundary" then
      path._missionName = nil
      gameplay_crawl_saveSystem.savePath(path, path._filePath)
    end
    if newObject then
      success = gameplay_crawl_saveSystem.savePath(newObject, filePath)
    end
            if path._dirty then
              if gameplay_crawl_saveSystem.savePath(path, path._filePath) then
                savedCount = savedCount + 1
            if path._dirty then
              if gameplay_crawl_saveSystem.savePath(path, path._filePath) then
                savedCount = savedCount + 1
          if selectedPath then
            if gameplay_crawl_saveSystem.savePath(selectedPath, selectedPath._filePath) then
              selectedPath._dirty = false
@/lua/ge/extensions/gameplay/missions/missionTypes/editorHelper.lua
          local cedit = editor_camPathEditor
          core_paths.savePath(editor_camPathEditor.currentPath, mission.missionFolder .. fl)
        end
@/lua/ge/extensions/editor/camPathEditor.lua
        if M.currentPath.filename then
          core_paths.savePath(M.currentPath, M.currentPath.filename)
        else
          extensions.editor_fileDialog.saveFile(function(data)
            core_paths.savePath(M.currentPath, data.filepath)
          end, { { 'Camera Path Files', '.camPath.json' } }, false, currentLevelPath)
@/lua/ge/extensions/editor/crawlEditor/missionPortTool.lua
  local boundarySuccess = gameplay_crawl_saveSystem.saveBoundary(boundary, boundaryFile)
  local pathSuccess = gameplay_crawl_saveSystem.savePath(path, pathFile)
@/lua/ge/extensions/core/paths.lua

local function savePath(cameraPath, filename)
  local pathCopy = deepcopy(cameraPath)