What I've tried was:
proc/TMDI_isAssociativeList(var/list/l)
if( (!l) || (!(istype(l,/list))) ) return FALSE
for(var/v in l)
if(l[v]) return TRUE
return FALSE
Now, that works ok, excepting the case where you've got simple numeric values as the list data. IOW, a regular numerically indexed string will return TRUE if the list data at l[x] is 1, 2, 3 or any numeric index within l.len. A list entry like l[x] = 0 will return a list index out of bounds error.
So, I added a line:
proc/TMDI_isAssociativeList(var/list/l)
if( (!l) || (!(istype(l,/list))) ) return FALSE
for(var/v in l)
if(isnum(v)) return FALSE
if(l[v]) return TRUE
return FALSE
Which will return an incorrect FALSE if the associative list is indexed with numbers. It also seems to me this will break in some other circumstance, but I can't put my finger on it.
Is there a way to do this well?
What am I missing?
So given that, I suppose you could just check to see if there's any values in the list that are are null.
If that doesn't work, then: