Is it possible to create a list of obects?

When I create an object, I'm able to access the items in the object by using object.name, object.color, etc. When I put several objects in a list, I'm no longer able to access the items in the objects anymore. Is it possible to do this in eggplant and if so, how?

Comments

  • Hi!

    See the sample script below for an explanation on how to access object properties and, specifically, properties from within a list of objects.
    set shape to (name:"rectangle", color:"blue")  //create object
    put "small" into property size of shape   //add a new property to the object "shape"
    put shape.size  //access object properties
    
    set shoe to (name: "tennis", color: "white", laces: "yes")  //create a new object
    
    set mylist to (shape, shoe)  //create a list of objects
    
    put the name of item 1 of mylist    //access properties of a nested object
    
    

    Let us know if you need additional help with this.
Sign In or Register to comment.