[SOLVED] Implement 'for' loop on attribute

i’ve got this attribute
SelectionMouseInput.attributes.add ('Objects', { type: 'entity', array: true, title: 'Objects to select' });

and each of the objects have a script that contains this

PositionThis.attributes.add('myIndex', {
    type: 'number'

I try to primitively create a loop

    for(var i=0; i<this.Objects.Length; i++)

but pretty much nothing happens, not even an error

anyone got a clew what did i do wrong?
if needed, her’s the link

It should be this.Objects.length not this.Objects.Length

It doesn’t give an error as it’s ‘valid’ to check a number against an undefined value.

but now the line console.log("hello"+this.Objects[i].script.PositionThis.myIndex); throws an error “cannot read property index of undefined”.
i went by this post

where you wrote this.otherEntity.script.script2.printCount.
where is the diference?

the caller script has
SelectionMouseInput.attributes.add ('Objects', { type: 'entity', array: true, title: 'Objects to select' });

the array is assigned with entities that each has the PositionThis script.
position this has this attribute
PositionThis.attributes.add('myIndex', { type: 'number' });


Refer to this guide I wrote up: How to refer to different parts of the API while scripting


Try the following:


looks a bit foolish on my side to bother you, it seems it was a typo mistake, i need to check my typo closer (though i did and still missed it) - it should have been positionThis and not PositionThis.