Adding 1 to an array
JimAultWins at yahoo.com
Sat Jun 23 16:04:07 CDT 2007
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.
This will work, but it is not what you want to do:
function index_CreateArray someIndex, someNumber
split someIndex by CR and tab
add someNumber to someIndex[it]
combine someIndex by CR and tab
There must be more to the story, but why not use two lines and forget the
split it using cr and comma
On 6/23/07 1:28 PM, "David Bovill" <david at openpartnership.net> wrote:
> Why does this function not work:
> function index_CreateArray someIndex, someNumber
>> split someIndex by CR and tab
>> add someNumber to someIndex
>> combine someIndex by CR and tab
>> return someIndex
>> end index_CreateArray
> But I get an error with:
> put index_CreateArray("Hello",1)
>> From the docs:
> If a number is added to an arrayContainer, the number is added to each
>> element. If an array is added to an arrayContainer, both arrays must have
>> the same number of elements and the same dimension, and each element in the
>> array is added to the corresponding element of the arrayContainer.
>> If the container or an element of the arrayContainer is empty, the add
>> command treats its contents as zero.
More information about the use-livecode