MSUTeam / MSU

Modding Standards and Utilities for Battle Brothers
22 stars 4 forks source link

feat: add removeValues function to array utilities #399

Closed LordMidas closed 2 months ago

LordMidas commented 2 months ago

This function removes given values from an array in place as opposed to the native filter function that returns a new array. Doing _values.find is expected to be faster than first converting _values to a local table and then using in for each element in _array. This is because looking up values that don't exist in a table is a slower operation than using find on an array especially at smaller len - which _values is expected to have.

TaroEld commented 2 months ago

Pretty sure endy meant returning the removed values as an array would be non standard.