Advanced

Re: Please, help me to sort results of popular scripts under my ownership

Please, help me to sort results of popular scripts under my ownership
May 13, 2017 12:22PM
Hi guys,

quite a while ago I created (well .. copied & edited) couple of scripts which are now hugely popular.
Particulary Generic Country checker, Generic Region checker and Generic County checker. Take Country one as example.

It carries plenty of tags but I know it is not perfect. Specifically, I don't like it produces output which is not sorted as expected. I tried to fix the sorting in script couple of times, but I have to admit my limited skills in LUA (sorry!) and I can't get it right. I'd be very thankful if someone can look at the code and let me know, what should be added/changed, please.

Noone asked for it, it is just me who wants to make it better.

Take this simple checker as example - http://project-gc.com/Challenges/GC75BJ5/26409.
It lists one cache per country you have found. But one cache is picked kind of "randomly" (or I don't understand how). I'd like to get sorted result - it means, the first of your finds in each country.

I think the change in the script should be something very easy, but I couldn't figure it out (ashamed).

In case you have any other suggestion, how to make output of these Generic scripts better, I'd be happy to modify these scripts.

Thank you so much for reading.

Rikitan
Re: Please, help me to sort results of popular scripts under my ownership
May 15, 2017 03:13PM
look at the Sorting table iterator in http://project-gc.com/forum/read?4,111

When you have copied the code for the iterator it is likely that you only need to change the Pairs or Ipairs with a spairs and add the compare function with the sorting you like
Re: Please, help me to sort results of popular scripts under my ownership
May 16, 2017 03:13AM
Thanks for tutorial, it looks great .. I'll try it.
Sorry, you do not have permission to post/reply in this forum.