VoidExpanse/scope-storage

From AtomicTorchWiki


Scope storage

Extremely useful scope for persistent, global variables and data storage. Used in complex quests and overall in game. Storage has tables and entries, which can contain any javascript object. This scope and it's data can be accessible from any other script.

Visibility: Global.

List of functions

Get
Arguments Returns Example
  • string: table_name
  • string: key_name

object

storage.Get("quest_rats_in_the_cellar", "house");
Description

Retrieves object, which was set with storage.Set call.


Remove
Arguments Returns Example
  • string: table_name
  • string: key_name

void

storage.Remove("quest_rats_in_the_cellar", "house");
Description

Removes an entry from storage.


Set
Arguments Returns Example
  • string: table_name
  • string: key_name
  • object: value

void

storage.Set("quest_rats_in_the_cellar",
	"house",
	{address: "Moscow, Krasnaya street, house 66"});
Description

Sets an entry in specified table.


GetGlobal
Arguments Returns Example
  • string: key_name

object

storage.GetGlobal("best_player_id");
Description

Gets an entry from table "default".


IsSetGlobal
Arguments Returns Example
  • string: key_name

bool

storage.IsSetGlobal("best_player_id");
Description

Returns whether variable in "default" table is set.


RemoveGlobal
Arguments Returns Example
  • string: key_name

void

storage.RemoveGlobal("best_player_id");
Description

Removes an entry from storage.


SetGlobal
Arguments Returns Example
  • string: key_name
  • object: value

void

storage.SetGlobal("best_player_id", {name: "dlirry"});
Description

Sets an entry in global table "default".