View Single Post
Author Message
shauli
Member
Join Date: Jun 2018
Old 09-03-2018 , 16:41   Questions and suggestions about ArrayFindString and sorting natives
Reply With Quote #1

Hi, have a few questions about the sort natives and ArrayFindString native:

1. Recently I came across a problem with sorting an array that has a lot of equal items. After the sorting, the items are being "shifted" down for some reason and I don't know if it's supposed to be like this. Here's an example code:
Spoiler

Result:
Quote:
0 | 1
1 | 2
2 | 3
3 | 4
4 | 0
The result is the same when I tried it on SortCustom1D, ArraySort or ArraySortEx.
If all the items are equal (according to my sort algorithm), so why does the index change? shouldn't it stay the exact same?

Also -- on a side note, would be really cool to have a cmp(x,y) native/stock inside a default include file, just like floatcmp has one.

2. ArrayFindString checking contain instead of equal and is case sensitive. Basically this makes this native useless 90% of the the times, it's to dangerous to use it if it's acting like 'contain' (instead of 'equal') and it's not very practical. If I have an array of SteamIDS, I might get STEAM_0:111156 when searching for STEAM_0:1111. If I have an array of maps I might get de_dust2 when searching for de_dust. Would be very nice to have a parameter for case insensitive/case sensitive and maybe a param/second native if to act like 'contain' or 'equal'.

Thank you for keeping this project alive, everyone.
shauli is offline