Diarkis Room を使って競合をおこさずにルームの数値プロパティを更新する

Room の数値プロパティをインクリメントまたはデクリメントする方法

Room モジュールには、数値プロパティをインクリメントおよび/またはデクリメントする API があります。これは、同期的に数値プロパティを更新する必要がある場合に便利です。

// If the property called HP does not exist, it will create it
created := room.IncrProperty(roomID, "HP", 1000)

// Decrement the property called HP by -200
decremented := room.IncrProperty(roomID, "HP", -200)

// Increment the property called HP by 100
incremented := room.IncrProperty(roomID, "HP", 100)