Options
All
  • Public
  • Public/Protected
  • All
Menu

Module used to save data between world sessions

Index

Type Aliases

LoadScopeFunc: ((scope: Nullable<object>) => void)

Type declaration

    • Function that loads data from scope

      Parameters

      Returns void

SaveScopeFunc: (() => object)

Type declaration

    • (): object
    • Function that returns object representing created scope. No primitives are allowed as return value

      Returns object

Functions

  • Creates saves scope, a universal data storage container. This storage container should be used whenever you need to save some data between world sessions. If you want to store primitives, use an object to wrap them

    Example:

    var thirst = 20;
    Saver.addSavesScope("thirst",
    function read(scope){
    thirst = scope? scope.thirst: 20;
    },

    function save(){
    return {"value": thirst};
    }
    );

    Parameters

    • name: string

      saves scope name

    • loadFunc: LoadScopeFunc

      function used to load saved data

    • saveFunc: SaveScopeFunc

      function used to save data

    Returns void

  • registerObject(obj: any, saverId: any): void
  • registerObjectSaver(name: string, saver: any): void
  • registerScopeSaver(name: string, saver: any): ScopeSaver
  • setObjectIgnored(obj: any, ignore: any): void

Generated using TypeDoc