code/__HELPERS/_lists.dm
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. |
/proc/sort_list | sort any value in a list |
/proc/bitfield_to_list | Converts a bitfield to a list of numbers (or words if a wordlist is provided) |
/proc/pick_weight | Picks a random element from a list based on a weighting system. For example, given the following list: A = 6, B = 3, C = 1, D = 0 A would have a 60% chance of being picked, B would have a 30% chance of being picked, C would have a 10% chance of being picked, and D would have a 0% chance of being picked. You should only pass integers in. |
/proc/list_clear_nulls | Removes any null entries from the list Returns TRUE if the list had nulls, FALSE otherwise |
/proc/unique_list | Return a list with no duplicate entries |
/proc/unique_list_in_place | same as unique_list, but returns nothing and acts on list in place (also handles associated values properly) |
/proc/shuffle_inplace | same as shuffle, but returns nothing and acts on list in place |
Define Details
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.
COMPARE_KEY
Passed into BINARY_INSERT to compare keys
COMPARE_VALUE
Passed into BINARY_INSERT to compare values