Allow custom sort natives and callback use optional data #1124
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
32 main things done withSortCustom1D
,SortCustom2D
, andArrayList.SortCustom
natives:- AllowMerged from #2146any
variable to custom sort rather than limited toint
. Meaning floats, enums, methodmap etc can be used to pass and custom sort.Handle hndl
pass toany data
, and not required in callback params. I don't see anywhere on why it should be limited to handles, so allowany
without needing to create new handles. Also updated core to usecell_t
data, doesn't make any difference but may well then do it.ArrayList
instead ofHandle
inSortFuncADTArray
callback.Handle
variable can still be used from old plugins.Only thing missing is
any
for regular 1D sorting. I'm not sure if it a good idea to allowany
inSortIntegers
native to sort enums, but i left it untouched.SortADTArrayCustom
also left untouched because we haveArrayList.SortCustom
traditional syntax instead.Hopefully i didn't miss anything that would break old plugins, but please do let me know if i did break one.
Compiled with this, no warnings and tested.