docs(standard): add `nodiscard` to immutable array functions
Summary
Some functions are expecting the return value to be used, as they should have no side effects themselves as being immuntable.
Add nodiscard to these functions allows to faster spot potential bugs in the code (such as was seen with #4183)
How did you test this change?
tested by hjp
Done the fixes, but not tested, would be great is someone could
tested (via previews) on dota, lol, brawlstars, valorant, wildrift, overwatch and stormgate
Given most of the changes happen to
Array.mapIndexes, would it make sense to add a second version of that, e.g.forEachIndexedor something, which would not return anything? Iterating a second time shouldn't really be necessary, no? Otherwise, doeslocal _ = Array.mapIndexesalso silence the errors?
I agree that some new function would be better, and have it stop when an iteration returns false/nil (or continue until they stop returning a true?). Not sure what a good name would be though. forEachIndexed. Maybe just call it for and have optional(?) params which are starting and ending indexed that default to 1 and math.huge? So it would just be a for index = startIndex, endIndex do loop but in a function. Or we could just use for index = 1, math.huge do instead :p
I agree that some new function would be better, and have it stop when an iteration returns false/nil (or continue until they stop returning a true?). Not sure what a good name would be though.
forEachIndexed. Maybe just call itforand have optional(?) params which are starting and ending indexed that default to1andmath.huge? So it would just be afor index = startIndex, endIndex doloop but in a function. Or we could just usefor index = 1, math.huge doinstead :p
Blame me for not looking up what the function actually does. Nontheless, it looks like all the usages shown in this PR aren't the intended use case