I would like to know how to pass self to an other object in mootools, I am trying to build classes based on mootools class declaration, but i am noticing i cannot send the object itself using this when i use this it sends DOMWindow instead of World or the object itself, the following is my code,
var World = new Class({
....
initialize: function(rows, ...) {
// build grass // can only have one grass per location
this.grassList = Enumerable.Range(0, rows).SelectMany(
function(row) {
return Enumerable.Range(0, columns).Select(
function(column) {
return new Grass(this, new Location(row, column), quantityOfGrass, maxQuantityOfGrass, growRateOfGrass)
})
}).ToArray();
}
....
}
I'm facing problem at this location,
return new Grass(this, new Location(row, column), quantityOfGrass, maxQuantityOfGrass, growRateOfGrass)
since it didn't work i checked for,
return new Grass(World, new Location(row, column), quantityOfGrass, maxQuantityOfGrass, growRateOfGrass)
it didn't work either i am using linq.js and mootools could someone guide me?