По спискам, я думаю функционал и АПИ закрыт
вот новая версия скрипта.
Переписал большинство циклов на !!re , осталась пара мест где SN:G просто удобнее и компактнее.
Функция сортировки по натуральному значению использует мой кастомный алгоритм, должно быть быстрее чем пузырьком и скорее всего быстрее сортировки рассческой (comb sort).
Функция сортировки с использованием компаратора реализована алгоритмом сортировки перемешиванием (cocktail sort) с небольшой модификацией (вторая часть алгоритма реализована не пузырьком, а сортировкой рассческой (comb sort) ).
В конце файла расположен тестовый код его 100% нужно удалить или закаментить перед использованием (там неплохой юнит тест написан, который сам по себе может служить подсказкой по использованию).
**
Добавил функции множественного гета, и фильтрации. Добавил в функции где это актуально проверку валидности аргументов и вызов FU(Fun_ShowError) в случае неверных входных аргументов (описание ошибки в z1).
Короткая справка по АПИ (полностью можно посмотреть в файле):
**
Переделал кастомизированные версии функций "сортировки", "поиска", "фильтрации" и "для каждого элемента" так чтобы они получали имя коллбек функции через аргумент вызова (спасибо товарищу
Berserker, за подсказку).
В принципе считаю что уже всё готово и достаточно протестировано. Можно использовать. Пока больше не планирую ничего тут менять.
Короткая справка по АПИ:
Code:
** Short usage description:
** 1. Create new list:
** * !FU(Fun_ListNew):P0/0/?y1; [y1, get the list ID you should use it to do operations with this list]
**
** 2. use any of the following functions to work with your list:
** * !FU(Fun_ListSize):Py1/?y2; [y2, number of the elements in the list]
** * !FU(Fun_ListClear):Py1; [delete all elements stored in list y1]
**
** * !FU(Fun_ListInsert):Py1/1/332/?y3; [y3, status of insert operation (add 332 as element #1 in the list)]
** * !FU(Fun_ListInsertFast)Py1/1/331/?y3;[y3, status of insert operation (add 331 as element #1 in the list but the order of the other list elements will change)]
** * !FU(Fun_ListAppend):Py1/333/?y3; [y3, status of append operation (add 333 as last element of the list)]
**
** * !FU(Fun_ListGet):Py1/1/0/?y2/?y3; [y2, y3, value of list element #1 and status of get operation]
** * !FU(Fun_ListSet):Py1/1/999/?y3; [y3, status of set operation (change list element #1 value to 999)]
** * !FU(Fun_ListMultiGet):Py1/1/0/?y4/?y5/?y6/?y7; [y4, y5, y6, y7, number of elements actually read from the list; list elements #1..#3 values]
**
** * !FU(Fun_ListSwap):Py1/1/2/?y3; [y3, status of swap operation (exchange values of list element #1 and list element #2)]
**
** * !FU(Fun_ListNew):P0/0/?y11; [y11, list ID of newly created temporary list]
** * !FU(Fun_ListCopy):Py1/y11; [copy content of y1 list into y11 list (original y11 list elements will be destroyed)]
** * !FU(Fun_ListDestroy):Py11; [destroy list y11 to free game resources]
**
** * !FU(Fun_ListSort):Py1/0; [sort the list in ascending order (x2 == 0: ASCENDING; 1: DESCENDING)]
** * !FU(Fun_ListFind):Py1/22/0/0/?y4; [y4, index of first element with value 22 in the list]
**
** * !FU(Fun_ListSortCustom):Py1/0/(your_sort_comparator_function_name); [sort the list in ascending order (x2 == 0: ASCENDING; 1: DESCENDING) using CUSTOM COMPARATOR you should implement in your mod ?FU(your_sort_comparator_function_name); API see below.]
**
** * !FU(Fun_ListFindCustom):Py1/23/0/0/(your_search_comparator_function_name)?y5;[y5, index of first found elemnent marked as search result by FU(your_search_comparator_function_name) you should implement in your mod ?FU(your_search_comparator_function_name); API see below.]
**
** * !FU(Fun_ListForEach):Py1/0/0/0/(your_foreach_callback_function_name); [calls function FU(your_foreach_callback_function_name) for each list element you should implement in your mod ?FU(your_foreach_callback_function_name); API see below.]
**
** * !FU(Fun_ListFilter):Py1/0/0/(your_filter_callback_function_name); [calls function FU(your_filter_callback_function_name) for each list element and removes elements marked by this function you should implement in your mod ?FU(your_filter_callback_function_name); API see below.]
**
** * !FU(Fun_ListRemove):Py1/1/?y3; [y3, status of remove operation (remove element #1 from list)]
** * !FU(Fun_ListRemoveFast)Py1/1/?y3; [y3, status of remove operation (remove element #1 from list but the order of the remaining list elements will change)]
**
** ...
**
** x. Destroy the list when you don't need it anymore:
** !FU(Fun_ListDestroy):Py1;