Hi, Guys...

I am trying to add my parsed string from my text file into
a multidimension array...

Here is my input data from the text file...
(Once again, I just broke it into multiple lines just for your eyes...)
---
TotalSymbols=4&
Symbols=
12!21!23!30!34!40!42!44!51!53~
11!13!22!30!31!33!34!41!43!51!53!62~
12!21!23!30!34!40!44!51!52!53~
12!21!23!30!34!40!42!44!51!53

and this is the format I want it to be in Director as an array...
-----
Symbols[1] = [12, 21, 23, 30, 34, 40, 42, 44, 51, 53]
Symbols[2] = [11, 13, 22, 30, 31, 33, 34, 41, 43, 51, 53, 62]
Symbols[3] = [12, 21, 23, 30, 34, 40, 44, 51, 52, 53]
Symbols[4] = [30, 40, 21, 51, 12, 42, 23, 53, 34, 44]

I think I kinda did parsing part and now I am trying to write this
string into an array, and I am getting an "Index out of range" error...
from line : Symbols[i].addAt(thisSpot, theData)

I hope this is the basic thing I am missing here... Sorry... I've been
up for almost 20 hours and my head hurts... I guess I should have gone
to sleep when I wanted... :(

Can someone tell me what is wrong with the code below???

I also have a question on this matter...
Right now I have just four arrays, but it will grow in numbers which
I do not know the size yet... And... AS you can see, not all of the
arrays have same length... Some has 10 some has 12... There is no
set value... Would it matter when I program it in Director???

Thanks...

---

on parseData
  blah
  blah
  blah
  ...
  ...
  ...

  set Symbols = []
  set thisSpot = 1
  set newVar = false
  set numChar = the number of chars in newVarData2

  repeat with i = 1 to TotalRecords
    repeat with j = 1 to numChar
      -- after running this repeat loop,
      -- all the data will be stored into the list
      currentChar = chars(newVarData2, j, j)
      set theData = theData & currentChar
      if currentChar = "!" then
        delete char the number of chars in theData of theData
        set theData = theData & ","
      end if
      if currentChar = "~" then
        delete char the number of chars in theData of theData
        Symbols[i].addAt(thisSpot, theData)
        thisSpot = thisSpot + 1
        exit repeat
      end if
    end repeat
    Symbols.addAt(i, Symbols[j])
  end repeat
end

---
>From the Debugger
---
currentChar="~"
Symbols=[]
thisSpot=1
i=1
j=30
theData="12,21,23,30,34,40,42,44,51,53"
---

Jason


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to