Garry's Mod Wiki

saverestore.AddRestoreHook

  saverestore.AddRestoreHook( string identifier, function callback )

Description

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

Arguments

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

You can also use those functions to read data:

Function callback arguments are:

  • IRestore save - The restore object to be used to read data from save file that is being loaded.

Example

Example usage.

saverestore.AddRestoreHook( "HookNameHere", function( save ) PrintTable( saverestore.ReadTable( save ) ) end )
Output: If you used example from saverestore.AddSaveHook
1 = Test