- Home /
How to declare a list of lists in JS?
Hi to all!
I can't figure it out, have tried all I could think of. Searched for an example fruitlessly... Can anybody help, please?
Many thanks and merry christmas!
var listOfLists = new List.>(); does not work... and have seen it written List>,, but that doesn't work in JS either... Anyone?
Answer by gregzo · Dec 24, 2011 at 01:45 PM
Have found the answer here: http://answers.unity3d.com/questions/42716/can-you-define-a-jagged-generic-list-in-unityscrip.html Very curious quirk of JS needs a space in there...
Answer by davedev · Dec 24, 2011 at 01:52 PM
Like this:
var mylist=[[1,2],[3,4]];
Debug.Log(mylist[0][0]);
or were you thinking of something different?
Your answer
![](https://koobas.hobune.stream/wayback/20220613062344im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Coding technique question 2 Answers
Error in my script i don't understand. 0 Answers
[Syntax] LINQ Query Operations in UnityScript ( Js ) 1 Answer
What means "as Unity.Object" on JS-Unity syntax? 1 Answer
Pulling an object inside the player 0 Answers