Garry's Mod Wiki

saverestore.AddSaveHook

  saverestore.AddSaveHook( string identifier, function callback )

Description

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

Arguments

1 string identifier
The unique identifier for this hook.
2 function callback
The function to be called when an engine save is being saved.

You can also use those functions to save data:

Function callback arguments are:

  • ISave save - The save object to be used to write data to the save file that is being saved.

Example

Example usage.

saverestore.AddSaveHook( "HookNameHere", function( save ) saverestore.WriteTable( { "test" }, save ) end )