var/grid = new/list(10,5)
var/i
for(i in grid)
i = "X"
usr << grid[1][1]
The problem is that the user receives nothing. This is not a skin issue either, I have tested that.
Any ideas on how to do this? Thanks
ID:265011
Oct 9 2011, 4:57 am
|
|
I'm trying to use a for loop to go through all the variables in a list that contains multiple lists, as shown :
var/grid = new/list(10,5) The problem is that the user receives nothing. This is not a skin issue either, I have tested that. Any ideas on how to do this? Thanks |
In response to Forum_account
|
|
Ah, thanks for that. Makes perfect sense now.
|
1. Setting i = "X" doesn't change what's stored in the list because "i" is just a reference to a value. You're changing the value of "i", the value that reference points to, not the value in the list. Even with a simple list this wouldn't work:
That doesn't change the values in the list.
2. The grid var is a list where each element is also a list. When you say "for(i in grid)" you're iterating over a set of 10 lists.
You'd want to do something like this: