Arrays and Lists

Jim Ault JimAultWins at yahoo.com
Mon Oct 17 16:17:55 EDT 2005


The short answer is that the operations you are doing simply return "" and
not an error message.  Run this and see if this makes sense to you

---------------------------- copy from here
--Array Load and Usage Example
--{note that I used two line break-continuations (\)  in the code}
--There were four variables standing at a bar waiting for a drink...
--oops wrong lesson notes...  here we go.. :-)

on mouseUp
  local myArray1
  local myArray2
  local myArrayX
  local myArrayY
  local myList
  
  --==Suggestion:  use less abstract example
  --declare variables if you wish (not necessary)
  local notebook
  local toDoList
  
  --add the values to the variable by specifying a key [""]
  
  ------working with variable notebook
  put "Test1" into notebook["recentTest"]
  put "Test2" into notebook["nextTest"]
  put "results from test 1 are good" into notebook["lastTestResult"]
  put "spend money" into notebook["actionToTake"]
  put "hire assistant" & cr & \
      "(prefer it not be my nephew)" into notebook["futurePlan"]
  
  ------working with variable toDoList
    put "make coffee" into toDoList["firstThing"]
  put "select donut" into toDoList["secondThing"]
  put "call bank about the financing for the investment."& \
      "  ->open new account" into toDoList["thirdThing"]
  put "make more coffee " into toDoList["priority1"]
  
  --now use the (variable *and* the key) to retrieve stored data
  
  answer notebook["actionToTake"]
  answer toDoList["priority1"]
  answer toDoList["thirdThing"]
  answer notebook["lastTestResult"]
  answer notebook["futurePlan"]
  
  --following returns empty since the toDoList has no "lastTestResult"
  answer toDoList["lastTestResult"]
  
  answer the keys of notebook
  answer the keys of toDoList
  
  
end mouseUp
-------------------- end copy       Array Load and Usage Example

Jim Ault
Las Vegas

On 10/17/05 7:18 AM, "David Burgun" <dburgun at dsl.pipex.com> wrote:

> on mouseUp
> local myArray1
> local myArray2
> local myArrayX
> local myArrayY
> local myList
> 
> put "Test1" into myArray1["Array1"]
> put "Test2" into myArray2["Array2"]
> 
> put myArray1 into item 1 of myList
> put myArray2 into item 2 of myList
> 
> put item 1 of myList myArrayX
> put item 2 of myList into myArrayY
> end mouseUp





More information about the use-livecode mailing list