Page 1 of 1
		
			
				Accessing lists like arrays
				
Posted: 
Sep 16, 2004 @ 8:45pm 
				by PointOfLight
				Is it possible to access a list like:
val$ = list$[1]
Or is this something you were at least thinking about putting in?  I seem to remember seeing this in the forum at some point.
			 
			
		
			
				
				
Posted: 
Sep 16, 2004 @ 9:14pm 
				by kornalius
				Yep, it is possible. Something to think about though.
list(l$);
Add(l$, "STRING");
If you want to access a string character in a list, you can't. The index array will move to the list pointer instead. You have to copy the list value to a temp variable in order to do this:
s$ = l$;
if (s$[1] == 'T')
...
end;
			 
			
		
			
				
				
Posted: 
Sep 16, 2004 @ 9:54pm 
				by PointOfLight
				Well, if you wouldn't be able to do:
val$ = list$[1]
where list$ is a list of strings, then I suppose that wouldn't be helpful, at least not for me.  Most of what I do with lists right now involves strings.
			 
			
		
			
				
				
Posted: 
Sep 16, 2004 @ 10:07pm 
				by kornalius
				No, I am just saying that you can't access a character in a string in a list. But a list of strings can be indexed no problem.
Ex:
List(l$);
Add(l$, "STRING1", "STRING2");
a$ = l$[0];
b$ = l$[1];
			 
			
		
			
				
				
Posted: 
Sep 16, 2004 @ 10:21pm 
				by PointOfLight
				Oh, well in that case I take back what I said  

  That actually would be cool.