This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2009-03-21 17:07:01

PsychScratchpad
Scratcher
Registered: 2009-03-19
Posts: 4

lists of lists

If the thought had never occurred to you before seeing the thread title, you may want to leave now before your head hurts.

Otherwise... well, I've got a question:
Is it possible to get data out of a list of lists?
I've discovered it's perfectly legal to

Insert [thing-that's-a-list] Into [list]

I can even

Set [var] To (Item [x] of [list])

Trouble is, var seems to only give me regular variables as options, and in any (Item [x] of [list]), only lists are selectable.

Have I discovered a bug in that lists can be added to lists to begin with, or is it a known limitation that I can't get data out when I do, or am I just being blind to the required block?

Offline

 

#2 2009-03-21 18:06:23

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: lists of lists

the (list) block returns a string - a line of text - with all list elements placed after another.

That means you cant have lists in lists, only numbers or strings (variables).


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#3 2009-03-21 18:24:44

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: lists of lists

Yes, it is intentional that you can place a list name as a list item or into a variable.  When you do that, the entire contents of the list are stuck together (concatenated) into one long text string.  There is no easy way, yet, to undo that operation though.  There may be some string functions coming along in version 1.4 that will help out, but that remains to be seen.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#4 2009-03-21 19:50:48

PsychScratchpad
Scratcher
Registered: 2009-03-19
Posts: 4

Re: lists of lists

Alright.  So strings are the currency of the realm for anything that can take "multiple data types"?

Offline

 

Board footer