CreatePersistentObject(roomId , persistentObjectStruct)

Description

This function creates a new persistent object in your server in the room you specified. It takes on the properties you list in the persistentObjectStruct as key value pairs

Syntax

CreatePersistentObject(roomId,persistentObjectStruct);
ArgumentDescription

roomId

The name of the room where this new persistent object will be created. This must be a String.

persistentObjectStruct

The properties of the persistent object you are creating. This must be a Struct with all the properties in key-value form.

Returns

N/A

Example Implementation

var ball = {
    type: "ball",
    _x : 200,
    _y : 200
}
CreatePersistentObject("public",ball)

This requests the server to create this object in the "public" room.

How to know if the Object was made or not?

After a successful creation of object on your server, the callback function callback_CreatedPersistentObject() is called.

Last updated