Module session

Session saving / loading functions

This module allows you to save your current session when quitting luakit, and then restore it again the next time you open luakit.

This module also provides a Lua API to allow other modules to save data to the session file and restore it when reopening Luakit.

Functions

session.save (file)

Save the current session state to a file.

If no file is specified, the path specified by session_file is used.

Parameters

  • file
    Type: string
    Optional
    The file path in which to save the session state.

session.load (delete, file)

Load session state from a file, and optionally delete it.

The session state is not restored. This function only loads the state into a table and returns it.

If no file is specified, the path specified by session_file is used.

If delete is not false, then the session file is deleted.

Parameters

  • delete
    Type: boolean
    Optional
    Whether to delete the file after the session is loaded.
  • file
    Type: string
    Optional
    The file path from which to load the session state.

session.restore (delete)

Restore the session state, optionally deleting the session file.

This will first attempt to restore the session saved at session_file. If that does not succeed, the session saved at recovery_file will be loaded.

If delete is not false, then the loaded session file is deleted.

Parameters

  • delete
    Type: boolean
    Optional
    Whether to delete the file after the session is restored.

Return Values

  • table
    The window table for the last window created.
  • nil
    If no session could be loaded, nil is returned.

Properties

session.session_file

Type: string
Read-write
Path to session file.

session.recovery_file

Type: string
Read-write
Path to crash recovery session file.

Attribution

Copyright