Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Lists (http://www.alice.org/community/showthread.php?t=6809)

ElectricKirby 06-22-2011 12:52 AM

Lists
 
Can I/How do I change the contents of a list at runtime?

reuben2011 06-22-2011 05:58 AM

Drag the list tile into the method editor. A pop-up should appear with various options. Use "insert..." to insert things into the list and "remove..." to remove things from the lists. Let me know if you need specifics on these. Another thing to remember is that the 1st item in the list has an index of 0, the 2nd item has a index of 1, and so forth. I don't see a "replace item at position <index>" function though (I guess I never used one.) There is a work around for this, just go:

remove <item> from position <index> of <list>
insert <item> at position <index> of <list>

You could make a replace method if you need to do a lot of replacing items in lists. Let me know if you need help. ;)

ElectricKirby 06-22-2011 07:09 AM

Haa, that's okay, I figured it out right after posting it

reuben2011 06-22-2011 11:31 AM

That's the nice thing about Alice, you tend to learn things yourself after fiddling with the tiles. ;)


All times are GMT -5. The time now is 02:43 AM.

Copyright ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.