Annoying DM list merging in Off Topic
|
|
While debugging a new feature to my pathfinder library I ran into an annoying problem. When using list.Add() and passing in a list it merges them and the same thing happens when using the + operator(which after reviewing the reference happens to be intended :P) this behaviour however is very annoying if you don't want a combined list rather a list of lists. Or in my case a list of seperate paths. Anyway if anyone else is trying this my solution to forcing the add rather than merging is this
var/L[] = new()
var/L2[] = list(1,2,3)
var/L3[] = list(4,5,6)
L[++L.len] = L2
L[++L.len] = L3
Which will result in L containing 2 seperate lists rather than one merged one if add were used. This feels a bit ad hoc so if anyone has a cleaner solution please comment :P.
|
var/L[] = new()
var/L2[] = list(1,2,3)
var/L3[] = list(4,5,6)
L += list(L2, L3)
would also work.