General Development

Linked Lists using Blitz3d – DeathFox

DeathFox
Member

Posts: 57
From:
Registered: 04-25-2006
Can someone plz help me. I found some samples like

Local food:String[] = ["Milk","Raisins","Hamburger","Spam"]

Local foodlist:TList = CreateList()

foodlist.addlast("Milk")
foodlist.addlast("Raisins")
foodlist.addlast("Hamburger")
foodlist.addlast("Spam")


now# = MilliSecs()
For loop = 10 To 100000
For x = 0 To Len(food)-1
'Print food[x]
Next
Next
elapsed# = MilliSecs()-now
Print "Array Elapsed:"+elapsed


now# = MilliSecs()
For loop = 10 To 100000
For n:String = EachIn foodlist
'Print n
Next

Next
elapsed# = MilliSecs()-now
Print "List Elapsed:"+elapsed


But this just gives me a Expecting ']' error. Someone plz help me.

Conan

Member

Posts: 69
From: the world
Registered: 06-27-2004
unless you have some weird lib, you made up the CreateList() function, and this line: 'Local food:String[] = ["Milk","Raisins","Hamburger","Spam"]' is all wrong, cos you're creating a static array of no size (which is bizzarre) and then assigning it to something that does not exist in Blitz 3D.

THERE ARE NO LISTS IN THIS LANGUAE.
At least not the Python-type lists you seem to be using...

That's the error.

And Blitz 3D comes with TYPES, which are effectively linked lists.

And you cant declare a variable as 'Whatever:String', but as Whatever$.

Read the manual, man...

------------------
Quantum Materiae Materietur Marmota Monax Si Marmota Monax Materiae Possum Materiari?

DeathFox
Member

Posts: 57
From:
Registered: 04-25-2006
Just got that code from a random website through google
Conan

Member

Posts: 69
From: the world
Registered: 06-27-2004
Just checked the manual for TYPES, they're the linked lists in Blitz3D, and at first might seem iffy, but you'll soon get the hang of em if you keep asking around.

------------------
Quantum Materiae Materietur Marmota Monax Si Marmota Monax Materiae Possum Materiari?