I have seen a piece of code that I can't figure out:
for (var m in client.actorTypes[d[5]]) {
if (m !== 'update' && m !== 'destroy' && m !== 'remove') {
this[m] = client.actorTypes[d[5]][m];
}
}
but actorTypes is not a 2D array:
Game.prototype.BaseActor = function(rate) {
this.updateRate = rate;
this.onCreate = function(data, complete) {};
this.onUpdate = function(data) {};
this.onEvent = function(data) {};
this.onInterleave = function() {};
this.onDraw = function() {};
this.onDestroy = function(complete) {};
};
Game.prototype.Actor = function(id, rate) {
return this.$.actorTypes[id] = new this.BaseActor(rate);
};
I actually don't know what happens in this code. Can someone explain it to me? What is a this array, and how could actorTypes become a 2d array?