Garry's Mod Wiki

The saverestore library contains functions relating to the singleplayer save system built into the game.

Methods

void saverestore.AddRestoreHook( string identifier, function callback )

Adds a restore/load hook for the Half-Life 2 save system.

void saverestore.AddSaveHook( string identifier, function callback )

Adds a save hook for the Half-Life 2 save system. You can this to carry data through level transitions in Half-Life 2.

void saverestore.LoadEntity( Entity ent, IRestore save )

Loads Entity:GetTable from the save game file that is being loaded and merges it with the given entitys Entity:GetTable.

void saverestore.LoadGlobal( IRestore save )
This is used internally - although you're able to use it you probably shouldn't.

Called by engine when a save is being loaded.

This handles loading gamemode and calls all of the hooks added with saverestore.AddRestoreHook.

void saverestore.PreRestore()
This is used internally - although you're able to use it you probably shouldn't.

Called by the engine just before saverestore.LoadGlobal is.

void saverestore.PreSave()
This is used internally - although you're able to use it you probably shouldn't.

Called by the engine just before saverestore.SaveGlobal is.

table saverestore.ReadTable( IRestore save )

Reads a table from the save game file that is being loaded.

any saverestore.ReadVar( IRestore save )

Loads a variable from the save game file that is being loaded.

Variables will be read in the save order you have saved them.

void saverestore.SaveEntity( Entity ent, ISave save )

Saves entitys Entity:GetTable to the save game file that is being saved.

void saverestore.SaveGlobal( ISave save )
This is used internally - although you're able to use it you probably shouldn't.

Called by engine when a save is being saved.

This handles saving gamemode and calls all of the hooks added with saverestore.AddSaveHook.

number saverestore.WritableKeysInTable( table table )

Returns how many writable keys are in the given table.

void saverestore.WriteTable( table table, ISave save )

Write a table to a save game file that is being saved.

void saverestore.WriteVar( any value, ISave save )

Writes a variable to the save game file that is being saved.

Page Links


Special Pages


Wikis

?

Render Time: 32ms

Session 0
DB GetPage 4
Generate Html 6
SaveChanges 9
Render Body 0
Render Sidebar 11