JavaScript SDK - myRoomActors has bugs?!

in DemoLoadBalancing.prototype.onJoinRoom = function(){...}
call PhotonService.myRoomActors()
the first player got correct result..
but, the 2nd player get the result: (top 2 actor in map is ok,but there are 7 func-like string keys follow on)
and, room.playerCount = 9.

{1: Actor, 2: Actor, "function (el) {↵ var i;↵ for (i = 0; i < this.length; i++) {↵ if (this[i] == el) return true;↵ }↵ return false;↵}": Actor, "function () {↵ var arr = [];↵ var i = 0;↵ for (; i < this.length; i++) {↵ switch (_typeof(this[i])) {↵ case 'object':↵ var obj = {};↵ for (key in this[i]) {↵ obj[key] = this[i][key];↵ }arr.push(obj);↵ break;↵ default:↵ arr.push(this[i]);↵ break;↵ }↵ }↵ return arr;↵}": Actor, "function () {↵ this.splice(0, this.length);↵}": Actor, "function (arr) {↵ if (arr) {↵ var i;↵ for (i = 0; i < arr.length; i++) {↵ this.push(arr[i]);↵ }↵ }↵}": Actor, "function (field) {↵ var arr = [];↵↵ var i = 0;↵ for (; i < this.length; i++) {↵ var val = field ? this[i][field] : this[i];↵ var index = this.lastIndexOf(val, field);↵ if (index == i) arr.push(this[i]);↵ }↵↵ return arr;↵}": Actor, …}
1
:
Actor {name: "User958", actorNr: 1, isLocal: false, customProperties: {…}, suspended: false, …}
2
:
Actor {name: "User197", actorNr: 2, isLocal: true, customProperties: {…}, suspended: false, …}
"function () {↵ this.splice(0, this.length);↵}"
:
Actor {name: "User958", actorNr: ƒ, isLocal: false, customProperties: {…}, suspended: false, …}
"function () {↵ var arr = [];↵ var i = 0;↵ for (; i < this.length; i++) {↵ switch (_typeof(this[i])) {↵ case 'object':↵ var obj = {};↵ for (key in this[i]) {↵ obj[key] = this[i][key];↵ }arr.push(obj);↵ break;↵ default:↵ arr.push(this[i]);↵ break;↵ }↵ }↵ return arr;↵}"
:
Actor {name: "User958", actorNr: ƒ, isLocal: false, customProperties: {…}, suspended: false, …}
"function (arr) {↵ if (arr) {↵ var i;↵ for (i = 0; i < arr.length; i++) {↵ this.push(arr[i]);↵ }↵ }↵}"
:
Actor {name: "User958", actorNr: ƒ, isLocal: false, customProperties: {…}, suspended: false, …}
"function (el) {↵ var i;↵ for (i = 0; i < this.length; i++) {↵ if (this[i] == el) return true;↵ }↵ return false;↵}"
:
Actor {name: "User958", actorNr: ƒ, isLocal: false, customProperties: {…}, suspended: false, …}
"function (field) {↵ var arr = [];↵↵ var i = 0;↵ for (; i < this.length; i++) {↵ var val = field ? this[i][field] : this[i];↵ var index = this.lastIndexOf(val, field);↵ if (index == i) arr.push(this[i]);↵ }↵↵ return arr;↵}"
:
Actor {name: "User958", actorNr: ƒ, isLocal: false, customProperties: {…}, suspended: false, …}
"function (field) {↵ var result = -1;↵↵ var i = 0;↵ for (; i < this.length; i++) {↵ var val = field ? this[i][field] : this[i];↵ if (val < result) result = val;↵ }↵↵ return result;↵}"
:
Actor {name: "User958", actorNr: ƒ, isLocal: false, customProperties: {…}, suspended: false, …}
"function (field) {↵ var result = -1;↵↵ var i = 0;↵ for (; i < this.length; i++) {↵ var val = field ? this[i][field] : this[i];↵ if (val > result) result = val;↵ }↵↵ return result;↵}"
:
Actor {name: "User958", actorNr: ƒ, isLocal: false, customProperties: {…}, suspended: false, …}
__proto__
:
Object

Comments

  • in Photon-Javascript_SDK.js
    line: 2795
    replace:
    // for (var i in actorList) {
    for (let i = 0; i < actorList.length; i++) {
  • vadimvadim ✭✭✭
    Thanks for bug report and fix.
    I can't reproduce this behavior in my test but obviously the code was wrong because it iterates over object properties, not array elements.
    I will update sdk package soon.
Sign In or Register to comment.