5 Replies Latest reply on Mar 28, 2007 2:54 AM by Newsgroup_User

    AddProp

    quinibi
      If you do

      bids.addProp(#kayne, 3)
      The result is the list [#gee: 4, #kayne: 3, #ohasi: 1].

      This statement adds the entry kayne: 7 to the list named bids, which now contains [#gee: 4, #kayne: 3, #ohasi: 1]. Because the list already contains the property kayne, Lingo creates a duplicate property:

      bids.addProp(#kayne, 7)
      The result is the list [#gee: 4, #kayne: 3, #kayne: 7, #ohasi: 1].

      How can I change the previous velue of #kayne instead of duplicate the property? I cannot find a suitable statement or a modifier in addProp...
        • 1. Re: AddProp
          Level 7
          use setProp or setAProp instead of addProp
          • 2. Re: AddProp
            Level 7
            If you use SetProp you will need to test to see if the property is already
            there otherwise you'll generate a script error.

            If you use SetAProp, it will add the property and value if it doesn't exist
            or modify the value if it does.

            Both have their place even though that for the first might not seem to at
            first glance.

            --
            Craig Wollman
            Lingo Specialist
            Word of Mouth Productions
            212-928-9581

            www.wordofmouthpros.com
            "quinibi" <webforumsuser@macromedia.com> wrote in message
            news:eubu6j$69q$1@forums.macromedia.com...
            > If you do
            >
            > bids.addProp(#kayne, 3)
            > The result is the list [#gee: 4, #kayne: 3, #ohasi: 1].
            >
            > This statement adds the entry kayne: 7 to the list named bids, which now
            > contains [#gee: 4, #kayne: 3, #ohasi: 1]. Because the list already
            > contains the
            > property kayne, Lingo creates a duplicate property:
            >
            > bids.addProp(#kayne, 7)
            > The result is the list [#gee: 4, #kayne: 3, #kayne: 7, #ohasi: 1].
            >
            > How can I change the previous velue of #kayne instead of duplicate the
            > property? I cannot find a suitable statement or a modifier in addProp...
            >


            • 3. Re: AddProp
              quinibi Level 1
              Thank you very much, that was very worthy
              • 4. Re: AddProp
                duckets Level 1
                quote:

                Originally posted by: Newsgroup User
                Both have their place even though that for the first might not seem to at
                first glance.


                Hi Craig,
                I have always used setaprop and getaprop because of the fact they don't generate an error if the property doesn't exist. I'm curious to know when you would choose to use setProp instead of setaProp?

                - Ben
                • 5. Re: AddProp
                  Level 7
                  I read a gaming article by either John Thompson or some other guru some time
                  ago entitled something like "Clock Cycles Matter" where he described the
                  slight difference in functions that can make a slight difference in
                  performance when executed many times. It was mentioned that setAProp is
                  performing an extra step to check for the existence of a property so it can
                  either 1) set the property or 2) add the property and set it.

                  --
                  Craig Wollman
                  Lingo Specialist
                  Word of Mouth Productions
                  212-928-9581

                  www.wordofmouthpros.com
                  "duckets" <webforumsuser@macromedia.com> wrote in message
                  news:eudakg$g5$1@forums.macromedia.com...
                  >
                  quote:

                  Originally posted by: Newsgroup User
                  > Both have their place even though that for the first might not seem to at
                  > first glance.

                  >
                  > Hi Craig,
                  > I have always used setaprop and getaprop because of the fact they don't
                  > generate an error if the property doesn't exist. I'm curious to know when
                  > you
                  > would choose to use setProp instead of setaProp?
                  >
                  > - Ben
                  >