Files
2025-02-05 06:19:18 +00:00

14 lines
9.4 KiB
HTML

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><base href="../../"><link rel="stylesheet" href="dmdoc.css"><title>code/__HELPERS/_lists.dm - /tg/ Station 13</title></head><body><header><a href="index.html">/tg/ Station 13</a> - <a href="index.html#modules">Modules</a> - <a href="index.html#types">Types</a><a href="code/__HELPERS/_lists.html#define">Define Details</a></header><main><h1>code/__HELPERS/_lists.dm <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/__HELPERS/_lists.dm0"><img src="git.png" width="16" height="16" title="code/__HELPERS/_lists.dm0"></a></h1><table class="summary" cellspacing="0"><tr><th><a href="code/__HELPERS/_lists.html#define/LIST_VALUE_WRAP_LISTS">LIST_VALUE_WRAP_LISTS</a></th><td>If value is a list, wrap it in a list so it can be used with list add/remove operations</td></tr><tr><th><a href="code/__HELPERS/_lists.html#define/UNTYPED_LIST_ADD">UNTYPED_LIST_ADD</a></th><td>Add an untyped item to a list, taking care to handle list items by wrapping them in a list to remove the footgun</td></tr><tr><th><a href="code/__HELPERS/_lists.html#define/UNTYPED_LIST_REMOVE">UNTYPED_LIST_REMOVE</a></th><td>Remove an untyped item to a list, taking care to handle list items by wrapping them in a list to remove the footgun</td></tr><tr><th><a href="code/__HELPERS/_lists.html#define/LAZYLISTDUPLICATE">LAZYLISTDUPLICATE</a></th><td>Like LAZYCOPY - copies an input list if the list has entries, If it doesn't the assigned list is nulled</td></tr><tr><th><a href="code/__HELPERS/_lists.html#define/LAZYACCESS">LAZYACCESS</a></th><td>returns L[I] if L exists and I is a valid index of L, runtimes if L is not a list</td></tr><tr><th><a href="code/__HELPERS/_lists.html#define/LAZYADDASSOCLIST">LAZYADDASSOCLIST</a></th><td>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)</td></tr><tr><th><a href="code/__HELPERS/_lists.html#define/LAZYADDASSOC">LAZYADDASSOC</a></th><td>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)</td></tr><tr><th><a href="code/__HELPERS/_lists.html#define/LAZYORASSOCLIST">LAZYORASSOCLIST</a></th><td>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.</td></tr><tr><th><a href="code/__HELPERS/_lists.html#define/COMPARE_KEY">COMPARE_KEY</a></th><td>Passed into BINARY_INSERT to compare keys</td></tr><tr><th><a href="code/__HELPERS/_lists.html#define/COMPARE_VALUE">COMPARE_VALUE</a></th><td>Passed into BINARY_INSERT to compare values</td></tr><tr><th><a href="code/__HELPERS/_lists.html#define/BINARY_INSERT">BINARY_INSERT</a></th><td>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.</td></tr><tr><th>/proc/<a href="global.html#proc/english_list_assoc">english_list_assoc</a></th><td>English_list but associative supporting. Higher overhead.
@depricated</td></tr><tr><th>/proc/<a href="global.html#proc/listgetindex">listgetindex</a></th><td>@depricated</td></tr><tr><th>/proc/<a href="global.html#proc/safepick">safepick</a></th><td>@depricated</td></tr><tr><th>/proc/<a href="global.html#proc/isemptylist">isemptylist</a></th><td>@depricated</td></tr><tr><th>/proc/<a href="global.html#proc/typecacheof">typecacheof</a></th><td>Like typesof() or subtypesof(), but returns a typecache instead of a list</td></tr><tr><th>/proc/<a href="global.html#proc/pick_n_take">pick_n_take</a></th><td>Pick a random element from the list and remove it from the list.</td></tr><tr><th>/proc/<a href="global.html#proc/find_record">find_record</a></th><td>Returns datum/data/record</td></tr></table><h2 id="define">Define Details</h2><h3 id="define/BINARY_INSERT"><aside class="declaration">#define </aside>BINARY_INSERT<aside>(INPUT, LIST, TYPECONT, COMPARE, COMPARISON, COMPTYPE)</aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/__HELPERS/_lists.dm#L72"><img src="git.png" width="16" height="16" title="code/__HELPERS/_lists.dm 72"></a></h3><p>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.</p><h3 id="define/COMPARE_KEY"><aside class="declaration">#define </aside>COMPARE_KEY <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/__HELPERS/_lists.dm#L59"><img src="git.png" width="16" height="16" title="code/__HELPERS/_lists.dm 59"></a></h3><p>Passed into BINARY_INSERT to compare keys</p><h3 id="define/COMPARE_VALUE"><aside class="declaration">#define </aside>COMPARE_VALUE <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/__HELPERS/_lists.dm#L61"><img src="git.png" width="16" height="16" title="code/__HELPERS/_lists.dm 61"></a></h3><p>Passed into BINARY_INSERT to compare values</p><h3 id="define/LAZYACCESS"><aside class="declaration">#define </aside>LAZYACCESS<aside>(L, I)</aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/__HELPERS/_lists.dm#L32"><img src="git.png" width="16" height="16" title="code/__HELPERS/_lists.dm 32"></a></h3><p>returns L[I] if L exists and I is a valid index of L, runtimes if L is not a list</p><h3 id="define/LAZYADDASSOC"><aside class="declaration">#define </aside>LAZYADDASSOC<aside>(L, K, V)</aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/__HELPERS/_lists.dm#L42"><img src="git.png" width="16" height="16" title="code/__HELPERS/_lists.dm 42"></a></h3><p>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)</p><h3 id="define/LAZYADDASSOCLIST"><aside class="declaration">#define </aside>LAZYADDASSOCLIST<aside>(L, K, V)</aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/__HELPERS/_lists.dm#L37"><img src="git.png" width="16" height="16" title="code/__HELPERS/_lists.dm 37"></a></h3><p>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)</p><h3 id="define/LAZYLISTDUPLICATE"><aside class="declaration">#define </aside>LAZYLISTDUPLICATE<aside>(L)</aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/__HELPERS/_lists.dm#L23"><img src="git.png" width="16" height="16" title="code/__HELPERS/_lists.dm 23"></a></h3><p>Like LAZYCOPY - copies an input list if the list has entries, If it doesn't the assigned list is nulled</p><h3 id="define/LAZYORASSOCLIST"><aside class="declaration">#define </aside>LAZYORASSOCLIST<aside>(lazy_list, key, value)</aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/__HELPERS/_lists.dm#L53"><img src="git.png" width="16" height="16" title="code/__HELPERS/_lists.dm 53"></a></h3><p>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.</p><h3 id="define/LIST_VALUE_WRAP_LISTS"><aside class="declaration">#define </aside>LIST_VALUE_WRAP_LISTS<aside>(value)</aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/__HELPERS/_lists.dm#L14"><img src="git.png" width="16" height="16" title="code/__HELPERS/_lists.dm 14"></a></h3><p>If value is a list, wrap it in a list so it can be used with list add/remove operations</p><h3 id="define/UNTYPED_LIST_ADD"><aside class="declaration">#define </aside>UNTYPED_LIST_ADD<aside>(list, item)</aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/__HELPERS/_lists.dm#L16"><img src="git.png" width="16" height="16" title="code/__HELPERS/_lists.dm 16"></a></h3><p>Add an untyped item to a list, taking care to handle list items by wrapping them in a list to remove the footgun</p><h3 id="define/UNTYPED_LIST_REMOVE"><aside class="declaration">#define </aside>UNTYPED_LIST_REMOVE<aside>(list, item)</aside> <a href="https://github.com/evilew/GS13-Citadel/blob/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e/code/__HELPERS/_lists.dm#L18"><img src="git.png" width="16" height="16" title="code/__HELPERS/_lists.dm 18"></a></h3><p>Remove an untyped item to a list, taking care to handle list items by wrapping them in a list to remove the footgun</p></main><footer>tgstation.dme <a href="https://github.com/evilew/GS13-Citadel/tree/e8e0068531dd988f9e65b33ae7866d4fbf1fdd9e">e8e0068</a> (master) — <a href="https://github.com/SpaceManiac/SpacemanDMM/blob/master/crates/dmdoc/README.md">dmdoc 1.9.0</a></footer></body></html>