saverestore.AddRestoreHook

From Garry's Mod
Jump to: navigation, search
 saverestore.AddRestoreHook( )

Contents

Description

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

Arguments

string identifier

The unique identifier for this hook.

Arguments

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


Examples

Example

Example usage.

saverestore.AddRestoreHook( "HookNameHere", function( save )
	PrintTable( saverestore.ReadTable( save ) )
end )

Output:

If you used example from saverestore.AddSaveHook
1 = Test
Personal tools
Navigation