Adding 1 to an array

Ken Ray kray at sonsothunder.com
Sat Jun 23 22:27:38 EDT 2007


On Sat, 23 Jun 2007 14:04:07 -0700, Jim Ault wrote:

> Looks like Rev does not work this way.
> Either it is a bug, docs are wrong, or it has been depricated and only works
> in the older versions.

The docs are *sort of* wrong... you can't do:

  add someNumber to someIndex

But you *can* do this:

  put someIndex + someNumber into someIndex

And it will update all the elements. here's a simple example without 
variables:

on mouseUp
  put 1 into tA[1]
  put 2 into tA[2]
  put 3 into tA[3]
  put tA + 1 into tA
  put tA[1],tA[2],tA[3]
end mouseUp

--> 2,3,4

Enjoy!

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/




More information about the use-livecode mailing list