YaDatastoreAPI
This API is used to get datastore and orderedDatastore objects.
Functions
Datastore YaDatastoreAPI.GetDatastore(string name, [string scope])
SERVER ONLY 
ReturnsA datastore object
Create a datastore instance with the provided name and scopenameThe name of the datastore instancescopeOptional parameter. The scope of the instance
 -- example GetDatastore
 local name = "backpack"
 local scope = "users"
 -- Create a datastore with the name 'backpack' and a global scope
 local datastore = YaDatastoreAPI.GetDatastore(name)
 -- Create a datastore instance with the name 'backpack' and the scope 'users'
 local datastore = YaDatastoreAPI.GetDatastore(name, scope)
Datastore YaDatastoreAPI.GetDatastoreWithOptions(string name, DatastoreOptions datastoreOptions, [string scope])
SERVER ONLY 
ReturnsA datastore instance
Create a datastore instance with provided name, scope and options.nameThe name of the datastore instancedatastoreOptionsThe options for the datastore instancescopeOptional parameter. The scope of the instance
-- example GetDatastoreWithOptions
local name = "backpack"
local scope = "users"
local opts = DatastoreOptions.New()
opts.ShareId = "shareId"
-- Create a datastore instance with the name 'backpack', with options set to be a shared space using its ID, and with scope set to 'users'
local datastore = YaDatastoreAPI.GetDatastoreWithOptions(name, opts, scope)
OrderedDatastore YaDatastoreAPI.GetOrderedDatastore(string name, [string scope])
SERVER ONLY 
ReturnsAn ordered data store instance
Create an ordered datastore instance with the provided name and scopenameThe name of orderedDatastorescopeOptional parameter. The scope of orderedDatastore
 -- example GetOrderedDatastore
 local name = "leaderboard"
 local scope = "users"
 -- Create an ordered datastore instance with the name 'leaderboard' and the scope automatically set to global
 local datastore = YaDatastoreAPI.GetOrderedDatastore(name)
 -- Create an ordered datastore instance with the name 'leaderboard' and the scope set to 'users'
 local datastore = YaDatastoreAPI.GetOrderedDatastore(name, scope)
OrderedDatastore YaDatastoreAPI.GetOrderedDatastoreWithOptions(string name, DatastoreOptions datastoreOptions, [string scope])
SERVER ONLY 
ReturnsA ordered datastore instance
Create a ordered datastore instance with provided name, scope and options.nameThe name of the orderedDatastore instancedatastoreOptionsThe options for the datastorescopeOptional parameter. The scope of the instance
-- Example GetOrderedDatastoreWithOptions
local name = "leaderboard"
local scope = "users"
local opts = DatastoreOptions.New()
opts.ShareId = "shareId"
-- Return the ordered data store given the name, otpions, and scope
local datastore = YaDatastoreAPI.GetOrderedDatastoreWithOptions(name, opts, scope)