GE Lua Documentation

Press F to search!

loadState

Definition


-- @/lua/ge/extensions/editor/main.lua:365

local function loadState(filePath)
  editor.logDebug("Loading editor state...")
  local state = jsonReadFile(filePath or editorCurrentStatePath) or {}

  if state.version ~= CurrentStateFileFormatVersion and not tableIsEmpty(state) then
    editor.logWarn("Editor state file format version mismatch. Expected: " .. CurrentStateFileFormatVersion .. " File: " .. tostring(state.version) .. ", will upgrade.")
    --TODO: upgrade code for older versions of the file
  end
  return state
end

Callers

@/lua/ge/extensions/editor/main.lua
    editor.levelPath = editor.getLevelPath()
    local state = loadState()
    loadAndInitializeExtensions()
    if not wasInitedNow then
      local state = loadState()
      editor.loadWindowsState()