Files
fulpstation/code/__HELPERS/string_assoc_lists.dm
SgtHunk 26a9e97803 August TGU: Wall leaning, ponies, cardboard IDs, smoothbore disablers and MUCH MORE! (#1032)
* this shit is like the ship of theseus bruh

* forgor dme

* updates maps

* some fixes just halfway through

* guhh

* ok

* whoops

* this one too

* that was such a stupid fix WHY

* fixes fulp ruin
2023-08-20 16:42:16 -07:00

18 lines
460 B
Plaintext

GLOBAL_LIST_EMPTY(string_assoc_lists)
/**
* Caches associative lists with non-numeric stringify-able index keys and stringify-able values (text/typepath -> text/path/number).
*/
/datum/proc/string_assoc_list(list/values)
var/list/string_id = list()
for(var/val in values)
string_id += "[val]_[values[val]]"
string_id = string_id.Join("-")
. = GLOB.string_assoc_lists[string_id]
if(.)
return .
return GLOB.string_assoc_lists[string_id] = values