HoarderService
Noir.Services.HoarderService: NoirService
A service for easily saving/loading class instances within a service with minimal hassle.
Example (see Hoardable code sample for info on the class side of things):
Noir.Services.HoarderService:_IsSerializable(value)Returns if a value is serializable.
Parameters
value: any
Returns
boolean
Noir.Services.HoarderService:_Serialize(tbl, _active)Serializes a table for saving by removing all functions.
Used internally.
Parameters
tbl: table_active: table<any, boolean>|nil
Returns
table
Adds class names as indices to a table of classes.
Used internally.
Parameters
classes: table<integer, NoirClass>
Returns
table<string, NoirClass>
Deserializes a serialized class instance.
Used internally.
Parameters
class: NoirHoardable|NoirClassserialized: tablelookupClasses: table<string, NoirClass>
Returns
NoirClass
Sets up a save data category for a service if it doesn't exist.
Used internally.
Parameters
service: NoirServicetblName: string
Invokes the checkpoint for the provided service and class if any.
It then returns the result which should be whether or not to load the instance and an optional overwritten location for the instance.
Used internally.
Parameters
service: NoirServiceclass: NoirClassinstance: NoirHoardable
Returns
booleantable|nil
Adds a checkpoint function for a service and class. It must return a boolean and an optional location for the instance.
if true is returned, the passed instance will be loaded.
if false is returned, the passed instance will not be loaded.
Example Checkpoint:
Parameters
service: NoirServiceclass: NoirHoardablefunc: NoirHoarderCheckpoint
Saves the provided class instance within a service.
Parameters
service: NoirServicetblName: string - The name of the sub-table in the provided service's savedata to save the serialized instance toinstance: NoirHoardable
Unhoards the provided class instance within a service.
Parameters
service: NoirServicetblName: stringinstance: NoirHoardable
Clears out saved instances for the provided service.
Parameters
service: NoirServicetblName: string
Loads all serialized class instances into a table in the provided service.
Parameters
service: NoirServicefrom: string - The name of the sub-table in the provided service's savedata to load the serialized instances fromto: table - The table to load the class instances intoclass: NoirHoardable - The class the serialized instances are oflookupClasses: table<integer, NoirClass> - A table of classes that the provided class may contain instances of. This is used to deserialize instances of classes that are not the provided class but may be contained within it.
Last updated