Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions core/logic/smn_sorting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,12 +584,16 @@ static cell_t sm_SortADTArrayCustom(IPluginContext *pContext, const cell_t *para

REGISTER_NATIVES(sortNatives)
{
{"SortIntegers", sm_SortIntegers},
{"SortFloats", sm_SortFloats},
{"SortStrings", sm_SortStrings},
{"SortCustom1D", sm_SortCustom1D},
{"SortCustom2D", sm_SortCustom2D},
{"SortADTArray", sm_SortADTArray},
{"SortADTArrayCustom", sm_SortADTArrayCustom},
{NULL, NULL},
{"SortIntegers", sm_SortIntegers},
{"SortFloats", sm_SortFloats},
{"SortStrings", sm_SortStrings},
{"SortCustom1D", sm_SortCustom1D},
{"SortCustom2D", sm_SortCustom2D},
{"SortADTArray", sm_SortADTArray},
{"SortADTArrayCustom", sm_SortADTArrayCustom},

{"ArrayList.Sort", sm_SortADTArray},
{"ArrayList.SortCustom", sm_SortADTArrayCustom},

{NULL, NULL},
};
16 changes: 16 additions & 0 deletions plugins/include/adt_array.inc
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,22 @@ methodmap ArrayList < Handle {
// @error Invalid block index
public native int FindValue(any item, int block=0);

/**
* Sort an ADT Array. Specify the type as Integer, Float, or String.
*
* @param order Sort order to use, same as other sorts.
* @param type Data type stored in the ADT Array
*/
public native void Sort(SortOrder order, SortType type);

/**
* Custom sorts an ADT Array. You must pass in a comparison function.
*
* @param sortfunc Sort comparison function to use
* @param hndl Optional Handle to pass through the comparison calls.
*/
public native void SortCustom(SortFuncADTArray sortfunc, Handle hndl=INVALID_HANDLE);

// Retrieve the size of the array.
property int Length {
public native get();
Expand Down