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. It has one argument:

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

You can also use those functions to read data:

saverestore.ReadVar

saverestore.ReadTable

saverestore.LoadEntity

Example

Example usage.

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

1 = Test

Page Links


Special Pages


Wikis

?

Render Time: 31ms

DB GetPage 3
Generate Html 5
SaveChanges (1) 14
Render Body 0
Render Sidebar 7