I know this is newbie... it's about Arrays.
Mark Brownell
gizmotron at earthlink.net
Mon Sep 8 23:14:01 EDT 2003
On Monday, September 8, 2003, at 08:16 PM, Andre Garzia wrote:
> Hi Folks,
>
> In the proccess of implementing XML-RPC in Revolution I decided to put
> all parameters inside an Array just to discover that I know nothing
> about arrays in Rev. I know they can have keyed items or numbered
> Items, thats all. My Rev online documentation says to me: "Check About
> Arrays and Matrixes" but this article is non existant. I need to know
> how to append an item to the array and how to count elements in it...
> I know this is silly for someone trying to implement a hole advanced
> remote procedure calling protocol, but life is like that, I am now
> able to place all my calls and almost parse them, but i just don't
> know how to append items in a array, is there a function for that?
I create my arrays with numbered keys. I store the number entries of
the current state of each array in a global array that I can call from
any handler or function that needs to know how many items there are in
each array. It just hit me...
I'm going to create a function that can manipulate all my numerical
keyed arrays so that it will allow me to sort my arrays, append my
arrays, and use "myArray[4]" to get and put the information in the
forth position in the myArray. It will allow me to use code like these
examples:
appendArray(myArray, "12 Monkeys") -- adds "12 Monkeys" to end of
myArray
appendArray(myArray, 1234) -- adds 1234 to end of myArray
deleteArray(myArray, 2) -- deletes all existence of 2 and reduces all
the rest by one
sortArray(myArray) -- sorts numerically and/or alphabetically myArray
addAtArray(myArray[3], "10 Monkeys")
-- use this instead of ( put "10 Monkeys" into myArray[3] )
-- just in case myArray only contained 2
-- this is to keep track of the number of items in an each array.
Now that I know how to save arrays into a customProperties file I can
add this function to my FrogBreath.rev example.
Seems like an nice addition. If I get this done I will post it here.
Mark
More information about the use-livecode
mailing list