code/__HELPERS/lists.dm ![code/__HELPERS/lists.dm0](git.png)
COMPARE_KEY | Passed into BINARY_INSERT to compare keys |
---|---|
COMPARE_VALUE | Passed into BINARY_INSERT to compare values |
BINARY_INSERT_TG | Binary search sorted insert from TG INPUT: Object to be inserted LIST: List to insert object into TYPECONT: The typepath of the contents of the list COMPARE: The object to compare against, usualy the same as INPUT COMPARISON: The variable on the objects to compare COMPTYPE: How should the values be compared? Either COMPARE_KEY or COMPARE_VALUE. |
LIST_VALUE_WRAP_LISTS | If value is a list, wrap it in a list so it can be used with list add/remove operations |
UNTYPED_LIST_ADD | Add an untyped item to a list, taking care to handle list items by wrapping them in a list to remove the footgun |
/proc/pickweight | Picks an element based on its weight. L - The input list |
/proc/pick_multiple_unique | Picks multiple unique elements from the suplied list. If the given list has a length less than the amount given then it will return a list with an equal amount |
LAZYINITLIST | Initialize the lazylist |
UNSETEMPTY | If the provided list is empty, set it to null |
ASSOC_UNSETEMPTY | If the provided key -> list is empty, remove it from the list |
LAZYLISTDUPLICATE | Like LAZYCOPY - copies an input list if the list has entries, If it doesn't the assigned list is nulled |
LAZYREMOVE | Remove an item from the list, set the list to null if empty |
LAZYADD | Add an item to the list, if the list is null it will initialize it |
LAZYOR | Add an item to the list if not already present, if the list is null it will initialize it |
LAZYDISTINCTADD | Adds I to L, initializing L if necessary, if I is not already in L |
LAZYACCESS | returns L[I] if L exists and I is a valid index of L, runtimes if L is not a list |
LAZYLEN | Returns the length of L |
LAZYNULL | Sets a list to null |
LAZYCLEARLIST | Removes all elements from the list |
LAZYCOPY | Use LAZYLISTDUPLICATE instead if you want it to null with no entries |
LAZYSET | Sets the item K to the value V, if the list is null it will initialize it |
LAZYSETLEN | Sets the length of a lazylist |
LAZYADDASSOC | Adds to the item K the value V, if the list is null it will initialize it |
LAZYADDASSOCLIST | This is used to add onto lazy assoc list when the value you're adding is a /list/. This one has extra safety over lazyaddassoc because the value could be null (and thus cant be used to += objects) |
LAZYREMOVEASSOC | Removes the value V from the item K, if the item K is empty will remove it from the list, if the list is empty will set the list to null |
LAZYACCESSASSOC | Accesses an associative list, returns null if nothing is found |
QDEL_LAZYLIST | Qdel every item in the list before setting the list to null |
LAZYIN | If the lazy list is currently initialized find item I in list L |
ISINDEXSAFE | Returns whether a numerical index is within a given list's bounds. Faster than isnull(LAZYACCESS(L, I)). |
LAZYORASSOCLIST | Performs an insertion on the given lazy list with the given key and value. If the value already exists, a new one will not be made. |
/proc/make_associative | A proc for turning a list into an associative list. |
/proc/compare_list | compare two lists, returns TRUE if they are the same |
/proc/avoid_assoc_duplicate_keys | takes an input_key, as text, and the list of keys already used, outputting a replacement key in the format of "[input_key] ([number_of_duplicates])" if it finds a duplicate use this for lists of things that might have the same name, like mobs or objects, that you plan on giving to a player as input |
/proc/assoc_to_keys | Turns an associative list into a flat list of keys |
Define Details
ASSOC_UNSETEMPTY ![code/__HELPERS/lists.dm 657](git.png)
If the provided key -> list is empty, remove it from the list
BINARY_INSERT_TG ![code/__HELPERS/lists.dm 26](git.png)
Binary search sorted insert from TG INPUT: Object to be inserted LIST: List to insert object into TYPECONT: The typepath of the contents of the list COMPARE: The object to compare against, usualy the same as INPUT COMPARISON: The variable on the objects to compare COMPTYPE: How should the values be compared? Either COMPARE_KEY or COMPARE_VALUE.
COMPARE_KEY ![code/__HELPERS/lists.dm 13](git.png)
Passed into BINARY_INSERT to compare keys
COMPARE_VALUE ![code/__HELPERS/lists.dm 15](git.png)
Passed into BINARY_INSERT to compare values
ISINDEXSAFE ![code/__HELPERS/lists.dm 697](git.png)
Returns whether a numerical index is within a given list's bounds. Faster than isnull(LAZYACCESS(L, I)).
LAZYACCESS ![code/__HELPERS/lists.dm 669](git.png)
returns L[I] if L exists and I is a valid index of L, runtimes if L is not a list
LAZYACCESSASSOC ![code/__HELPERS/lists.dm 691](git.png)
Accesses an associative list, returns null if nothing is found
LAZYADD ![code/__HELPERS/lists.dm 663](git.png)
Add an item to the list, if the list is null it will initialize it
LAZYADDASSOC ![code/__HELPERS/lists.dm 685](git.png)
Adds to the item K the value V, if the list is null it will initialize it
LAZYADDASSOCLIST ![code/__HELPERS/lists.dm 687](git.png)
This is used to add onto lazy assoc list when the value you're adding is a /list/. This one has extra safety over lazyaddassoc because the value could be null (and thus cant be used to += objects)
LAZYCLEARLIST ![code/__HELPERS/lists.dm 675](git.png)
Removes all elements from the list
LAZYCOPY ![code/__HELPERS/lists.dm 679](git.png)
Use LAZYLISTDUPLICATE instead if you want it to null with no entries
LAZYDISTINCTADD ![code/__HELPERS/lists.dm 667](git.png)
Adds I to L, initializing L if necessary, if I is not already in L
LAZYIN ![code/__HELPERS/lists.dm 695](git.png)
If the lazy list is currently initialized find item I in list L
LAZYINITLIST ![code/__HELPERS/lists.dm 653](git.png)
Initialize the lazylist
LAZYLEN ![code/__HELPERS/lists.dm 671](git.png)
Returns the length of L
LAZYLISTDUPLICATE ![code/__HELPERS/lists.dm 659](git.png)
Like LAZYCOPY - copies an input list if the list has entries, If it doesn't the assigned list is nulled
LAZYNULL ![code/__HELPERS/lists.dm 673](git.png)
Sets a list to null
LAZYOR ![code/__HELPERS/lists.dm 665](git.png)
Add an item to the list if not already present, if the list is null it will initialize it
LAZYORASSOCLIST ![code/__HELPERS/lists.dm 700](git.png)
Performs an insertion on the given lazy list with the given key and value. If the value already exists, a new one will not be made.
LAZYREMOVE ![code/__HELPERS/lists.dm 661](git.png)
Remove an item from the list, set the list to null if empty
LAZYREMOVEASSOC ![code/__HELPERS/lists.dm 689](git.png)
Removes the value V from the item K, if the item K is empty will remove it from the list, if the list is empty will set the list to null
LAZYSET ![code/__HELPERS/lists.dm 681](git.png)
Sets the item K to the value V, if the list is null it will initialize it
LAZYSETLEN ![code/__HELPERS/lists.dm 683](git.png)
Sets the length of a lazylist
LIST_VALUE_WRAP_LISTS ![code/__HELPERS/lists.dm 55](git.png)
If value is a list, wrap it in a list so it can be used with list add/remove operations
QDEL_LAZYLIST ![code/__HELPERS/lists.dm 693](git.png)
Qdel every item in the list before setting the list to null
UNSETEMPTY ![code/__HELPERS/lists.dm 655](git.png)
If the provided list is empty, set it to null
UNTYPED_LIST_ADD ![code/__HELPERS/lists.dm 57](git.png)
Add an untyped item to a list, taking care to handle list items by wrapping them in a list to remove the footgun