code/__HELPERS/_lists.dm ![code/__HELPERS/_lists.dm0](git.png)
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 |
UNTYPED_LIST_REMOVE | Remove an untyped item to a list, taking care to handle list items by wrapping them in a list to remove the footgun |
LAZYLISTDUPLICATE | Like LAZYCOPY - copies an input list if the list has entries, If it doesn't the assigned list is nulled |
LAZYACCESS | returns L[I] if L exists and I is a valid index of L, runtimes if L is not a list |
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) |
LAZYADDASSOC | 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) |
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. |
COMPARE_KEY | Passed into BINARY_INSERT to compare keys |
COMPARE_VALUE | Passed into BINARY_INSERT to compare values |
BINARY_INSERT | Binary search sorted insert 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. |
BINARY_INSERT_DEFINE | Even more custom binary search sorted insert, using defines instead of vars INPUT: Item to be inserted LIST: List to insert INPUT into TYPECONT: A define setting the var to the typepath of the contents of the list COMPARE: The item to compare against, usualy the same as INPUT COMPARISON: A define that takes an item to compare as input, and returns their comparable value COMPTYPE: How should the list be compared? Either COMPARE_KEY or COMPARE_VALUE. |
/proc/english_list_assoc | English_list but associative supporting. Higher overhead. @depricated |
/proc/listgetindex | @depricated |
/proc/safepick | @depricated |
/proc/isemptylist | @depricated |
/proc/typecacheof | Like typesof() or subtypesof(), but returns a typecache instead of a list |
/proc/pick_n_take | Pick a random element from the list and remove it from the list. |
/proc/find_record | Returns datum/data/record |
BINARY_INSERT_PROC_COMPARE | Custom binary search sorted insert utilising comparison procs instead of vars. 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 plaintext name of a proc on INPUT that takes a single argument to accept a single element from LIST and returns a positive, negative or zero number to perform a comparison. COMPTYPE: How should the values be compared? Either COMPARE_KEY or COMPARE_VALUE. |
ISINDEXSAFE | Returns whether a numerical index is within a given list's bounds. Faster than isnull(LAZYACCESS(L, I)). |
Define Details
BINARY_INSERT ![code/__HELPERS/_lists.dm 71](git.png)
Binary search sorted insert 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.
BINARY_INSERT_DEFINE ![code/__HELPERS/_lists.dm 109](git.png)
Even more custom binary search sorted insert, using defines instead of vars INPUT: Item to be inserted LIST: List to insert INPUT into TYPECONT: A define setting the var to the typepath of the contents of the list COMPARE: The item to compare against, usualy the same as INPUT COMPARISON: A define that takes an item to compare as input, and returns their comparable value COMPTYPE: How should the list be compared? Either COMPARE_KEY or COMPARE_VALUE.
BINARY_INSERT_PROC_COMPARE ![code/__HELPERS/_lists.dm 842](git.png)
Custom binary search sorted insert utilising comparison procs instead of vars. 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 plaintext name of a proc on INPUT that takes a single argument to accept a single element from LIST and returns a positive, negative or zero number to perform a comparison. COMPTYPE: How should the values be compared? Either COMPARE_KEY or COMPARE_VALUE.
COMPARE_KEY ![code/__HELPERS/_lists.dm 58](git.png)
Passed into BINARY_INSERT to compare keys
COMPARE_VALUE ![code/__HELPERS/_lists.dm 60](git.png)
Passed into BINARY_INSERT to compare values
ISINDEXSAFE ![code/__HELPERS/_lists.dm 879](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 32](git.png)
returns L[I] if L exists and I is a valid index of L, runtimes if L is not a list
LAZYADDASSOC ![code/__HELPERS/_lists.dm 41](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)
LAZYADDASSOCLIST ![code/__HELPERS/_lists.dm 36](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)
LAZYLISTDUPLICATE ![code/__HELPERS/_lists.dm 23](git.png)
Like LAZYCOPY - copies an input list if the list has entries, If it doesn't the assigned list is nulled
LAZYORASSOCLIST ![code/__HELPERS/_lists.dm 52](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.
LIST_VALUE_WRAP_LISTS ![code/__HELPERS/_lists.dm 14](git.png)
If value is a list, wrap it in a list so it can be used with list add/remove operations
UNTYPED_LIST_ADD ![code/__HELPERS/_lists.dm 16](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
UNTYPED_LIST_REMOVE ![code/__HELPERS/_lists.dm 18](git.png)
Remove an untyped item to a list, taking care to handle list items by wrapping them in a list to remove the footgun