intfiction.org

The Interactive Fiction Community Forum
It is currently Sun May 19, 2013 11:44 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 12 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Working with lists
PostPosted: Wed Mar 14, 2012 10:54 am 
Offline

Joined: Tue Apr 27, 2010 1:02 pm
Posts: 797
You can do both. In the iteration case, it's better to build it as a vector, then convert the vector to a list.

Code:
local lst = new Vector(50);
forEachInstance(Room, {room: lst.append(room)});
lst = lst.toList();


Lists and functions work very well together. A common pattern is to start with a list and filter it through many different functions (or recursively through the same function) before returning a value.


Top
 Profile Send private message  
 
 Post subject: Re: Working with lists
PostPosted: Wed Mar 14, 2012 11:16 am 
Offline
User avatar

Joined: Fri Jan 27, 2012 2:34 pm
Posts: 271
Location: Boston
Ok. I'm hearing I just can't reach inside and tweak it without a reassignment?

Thanks for clarifying, Ben.


Conrad.

_________________
http://tiltedcandle.wordpress.com


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group