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

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

You can also use those functions to save data:

saverestore.WriteVar

saverestore.WriteTable

saverestore.SaveEntity

Example

Example usage.

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

Page Links


Special Pages


Wikis

?

Render Time: 34ms

DB GetPage 4
Generate Html 7
SaveChanges (1) 9
Render Body 0
Render Sidebar 12