Adding 1 to an array
Jim Ault
JimAultWins at yahoo.com
Sat Jun 23 17:04:07 EDT 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
get someindex
split someIndex by CR and tab
add someNumber to someIndex[it]
combine someIndex by CR and tab
return someIndex
end index_CreateArray
There must be more to the story, but why not use two lines and forget the
function call?
get "hello,1"
split it using cr and comma
Jim Ault
Las Vegas
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
mailing list