Sign In Register

How can we help you today?

Start a new topic

How to increment to Game Data?

There is no increment function in GameData compared to other databases.

Can this count correctly? Are they preventing duplication due to requests at the same time?

var API = Spark.getGameDataService();

var entryObject = API.getItem("DATA", Spark.getData().OBJID);

if(entryObject.error()){
    Spark.setScriptError("ERROR", entryObject.error())
} else{
var entry = entryObject.document();
var data=entry.getData();
data.counter+=1;
var status = entry.persistor().persist().error();

 

1 Comment

Is the function "withAtomicIncrements()" related?

However, I can not find useful documents or examples about this function.

Login to post a comment