ID:260968
 
Well, i didn't know that many people would say "I didn't know about this".
It's also NOT documented on the reference, well now it should. What i mean is you can do this:

mob/verb/Test() {
world << src.ListReturn()[1];
}

mob/proc/ListReturn() {
var/list/MyList = new;
MyList += "Ocean King";
MyList += "woo!";
return MyList;
}

mob/verb/Test() {
for(var/Element in src.ListReturn()) {
world << Element;
}
}

mob/proc/ListReturn() {
var/list/MyList = new;
MyList += "Ocean King";
MyList += "This is second element on the list.";
MyList += "This is third element on the list.";
return MyList;
}

mob/verb/Test() {
var/list/ReturnedList = src.ListReturn();
world << ReturnedList[1][1]
world << ReturnedList[1][2]
world << ReturnedList[2][1]
world << ReturnedList[2][2]
}

mob/proc/ListReturn() {
var/list/MyList[2][2];
MyList[1][1] = "Ocean";
MyList[1][2] = "King";
MyList[2][1] = "Second";
MyList[2][2] = "Element";
return MyList;
}

mob
var
MyProc = /proc/ListReturn;

mob/verb/Test() {
world << call(MyProc)()[1];
}

/proc/ListReturn() {
var/list/MyList[1];
MyList[1] = "Ocean King";
return MyList;
}


Yes, you're able to do 'world << src.ListReturn()[1];' Since you're returning the list in the procedure it wll let you to access the list element.

Shouldn't this be added to the reference?
It's more like I thought it wasn't possible due to not being able to do ObjectReturn().var or something.

As an added bonus, I like to initialize my lists like this:
var mylist[0]
In response to Kaiochao
Kaiochao wrote:
It's more like I thought it wasn't possible due to not being able to do ObjectReturn().var or something.

As an added bonus, I like to initialize my lists like this:
> var mylist[0]
>


Yeah, i did that on some examples (Added them later lol).
In response to Kaiochao
Kaiochao wrote:
It's more like I thought it wasn't possible due to not being able to do ObjectReturn().var or something.

As an added bonus, I like to initialize my lists like this:
> var mylist[0]
>


I thought you can't do it with a returned Object because the token or whatever it's called ends, but something with lists and [] is different...
but yeah, I knew about lists returned working fine.