- Home /
Can you define a jagged Generic List in UnityScript?
C#:
List<List<T>>
Unity's JavaScript:
???
List.<List.<T>> //<--This is what I expected to work, but no.
Answer by Mike 3 · Jan 13, 2011 at 09:40 PM
You need a space after the T> :
List.< List.<T> >
or
List.<List.<T> >
I prefer the top one for symmetrical reasons, but both work
That's REALLY WEIRD. How did you know that? Is there any other example of whitespace mattering in this language?
I remember the same bug in c++ compilers, no clue if it's still there, so had a try to see if it was the case here. Anyhow - don't know of any other whitespace issues yet, no (Besides the obvious necessary ones)
Found that useful too. Where can I read about using List. in js? Can't seem to find anything...
The whitespace matters here because they need to differentiate between relational ("
Just spent an hour on this, glad to have found it here. Will link from my post "How to declare a list of lists in JS?" thanks, I could've kept on trying quite a while!
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
How to add to a list excluding certain items 1 Answer
JS Argument out of range 1 Answer
missingGameObject problem 3 Answers