sourcemod
sourcemod copied to clipboard
Change sort optional parameters from Handle to any and update SortFunc1D/2D typedef
- Change optional parameters from Handle to any; Not seeing any particular reason why they need to exclusively be a Handle.
- Modify the SortFunc2D typedef.
- Remove char typedef (char cannot be coerced to any).
- Change typeset to typedef and make the parameters
any
instead ofint
- Change Sort(Custom/Func)1D params from int to any
any and floats aren't friends, since the float operators aren't used if a float is tagged as any
. This could cause confusion when sorting float arrays.
Can you add a warning for float arrays?
any and floats aren't friends, since the float operators aren't used if a float is tagged as
any
. This could cause confusion when sorting float arrays.Can you add a warning for float arrays?
This seems like a general sp nuisance not specific to sort stuff that folks should be aware of in general, so I feel like this isn't the best place to put that info, though I don't mind adding a note I suppose.
any and floats aren't friends, since the float operators aren't used if a float is tagged as
any
. This could cause confusion when sorting float arrays.Can you add a warning for float arrays?
If they're retagged in the function prototype for comparison the correct operator will be used, no?
iirc you can pass in a float[] as any[], and in the comparison accept float type and not any
any and floats aren't friends, since the float operators aren't used if a float is tagged as
any
. This could cause confusion when sorting float arrays. Can you add a warning for float arrays?If they're retagged in the function prototype for comparison the correct operator will be used, no?
iirc you can pass in a float[] as any[], and in the comparison accept float type and not any
yep, that is also true
My pull request at #1124 is very identical to this apart from mine having optional data param in callbacks. No idea why my PR gets ignored, but this PR could be updated to have SortFunc(1D/2D/ADTArray) without having data param as optional.
@asherkin are you still OK with this?