ID:160073
 
Lets say I have big list:
var/grid[100][100]

Now lets say I have something at 40,40; 50,50; 55,55; 60,60:
grid[40][40]="me"
grid[50][50]="him1"
grid[55][55]="him2"
grid[60][60]="him3"

How to make proc, which will work like view() but in list?:
//range - range of view
//list - list to search in
//sx and sy - starting/current location
proc/lview(range,list,sx,sy)
//something...

for(var/A in lview(10,grid,40,40)
A<<"[A] you are stupid"
First of all, why are you working with so many lists? You have tons of lists initialized right there, it isn't good at all!

proc/lview(list,range,centerx,centery)
. = list()
for(var/X in (centerx-range) to (centerx+range))
for(var/Y in (centery-range) to (centery+range))
. += list[X][Y]


That should work. Just keep in mind what you're doing is just not that good in BYOND; just with that there you're about 1/6 of the way to hitting the list limit.
In response to Jeff8500
Hm... Thank you. I'll find use for it =)
Well it will be biggest list so I doubt I will reach list limit (unless I will forget to clear lists).