Breakroom is now Sinewave Campus. Book a meeting

SDatabase

ServeurStockage
Dans cette classeGetRegionValue
  1. Fonctions
  2. GetRegionValue
  3. SetRegionValue
  4. GetPlayerValue
  5. SetPlayerValue
Membres 4
FonctionGetRegionValueGet a value stored in the region database. (this does not access the same database as the SPersistence class)
FonctionSetRegionValueStore a "value" in the region database. (this does not access the same database as the SPersistence class)
FonctionGetPlayerValueGet a value stored in a player database. (this does not access the same database as the SPersistence class)
FonctionSetPlayerValueStore a "value" in a player database. (this does not access the same database as the SPersistence class). (this does not access the same database as the SPersistence class)

Fonctions​

GetRegionValue​

void GetRegionValue(string key, Closure onResult)

Get a value stored in the region database. (this does not access the same database as the SPersistence class)

Paramètres

ParameterTypeDescription
keystringThe "key" to access the record from the region database.
onResultClosureThe name of the function which will be called once the results are ready.
This function will be called with a string parameter containing the requested value. onResult(value)

Valeurs de retour

void

Exemple

Lua
function onResult(value)
yourValue = value
end

Space.Database.GetRegionValue("testKey", onResult)

SetRegionValue​

void SetRegionValue(string key, string value, Closure onSave)

Store a "value" in the region database. (this does not access the same database as the SPersistence class)

Paramètres

ParamètreTypeDescription
keystringThe "key" to access the record from the region database.
valuestringThe "value" that will be stored in the region database.
onSaveClosureThe name of the function which will be called when the "value" has been stored in the region database.

Valeurs de retour

void

Exemple

Lua
function onSave()
--
end

Space.Database.SetRegionValue("testKey", "testValue", onSave)

GetPlayerValue​

void GetPlayerValue(int player, string key, Closure onResult)

Get a value stored in a player database. (this does not access the same database as the SPersistence class)

Paramètres

ParamètreTypeDescription
playerintThe ID of the player's database in whose record we will access.
keystringThe "key" to access the record from the region database.
onResultClosure

The name of the function which will be called once the results are ready.
This function will be called with a string parameter containing the requested value. onResult(value)

Valeurs de retour

void

Exemple

Lua
function onResult(value)
yourValue = value
end

Space.Database.GetPlayerValue(aPlayerID,"testKey",onResult)

SetPlayerValue​

void SetPlayerValue(int player, string key, string value, Closure onSave)

Store a "value" in a player database. (this does not access the same database as the SPersistence class). (this does not access the same database as the SPersistence class)

Paramètres

ParamètreTypeDescription
playerintThe ID of the player's database in whose record we will access.
keystringThe "key" to access the record from the region database.
onSaveClosureThe name of the function which will be called when the "value" has been stored in the player database.

Valeurs de retour

void

Exemple

Lua
function onSave()
--
end

Space.Database.SetPlayerValue(aPlayerID,"testKey", "testValue",onSave)