Gamestudio Links
Zorro Links
Newest Posts
Series within loop
by Spirit
Today at 03:38
ein Truetype wie ein Bitmap Font laden?
by tagimbul
Yesterday at 21:46
'you' and c_scan
by 3run
Yesterday at 17:24
rayp's old school fast zombie FPS project
by 3run
Yesterday at 11:01
No Trades Using Workshop 6
by peterhw
Yesterday at 10:59
Actual PIP Cost for backtesting
by tradingest
10/14/18 16:36
Rigid Force Alpha - Classic side-scrolling shoot'em up
by Turrican
10/14/18 11:44
AUM Magazine
Latest Screens
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Evonet Beta v1.0 : Online Project Development Template
Lake scene
Who's Online
5 registered (kvm, Ayumi, jenGs, PSA, jumpman), 463 Guests and 4 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
BazGen, pallab1964, wOrlD21, peterhw, 7th_zorro
18076 Registered Users
Topic Options
Rate This Topic
#464838 - 03/14/17 18:16 sortIdx
hatten Offline

Registered: 07/01/16
Posts: 42
When using sortIdx I run into the problem that this function apparently checks the lookback period and yields and error if the number of elements of the array you wish to sort exceeds the lookback period. However I do wish to sort an array that is not a time series and whose dimension is unrelated to lookback issues. This function should be in file functions.c as it is declared in function.h. Unfortunately function.c is not part of the distribution, otherwise it would be easy to just copy the code for sortIdx and remove checklookback command, which I assume is the problem. Anyone has a code snippet for sorting as sortIdx does? The standard qsort c++ function is different as it rearranges the elements of the original array which I don't want.

#470424 - 01/13/18 16:09 Re: sortIdx [Re: hatten]
sdh309795gaas Offline

Registered: 12/07/14
Posts: 103
Same question here!

This doesn't work:

function main()
int n;
var myarray[4] = {1.5, 2.3, 0.1, 0.001};

int Idx = sortIdx(myarray, 4);

for(n=0, n < 4, n++)
printf("n%dth Index = %d",n,Idx[n]);


#470439 - 01/14/18 20:19 Re: sortIdx [Re: sdh309795gaas]
oligodar Offline

Registered: 12/08/13
Posts: 14
This code works for me:

function main(){
	int n;
	var myarray[4] = {1.5, 2.3, 0.1, 0.001};
	int* Idx = sortIdx(myarray, -4);
	for(n=0; n < 4; n++){
	    printf("\n%dth Index = %d",n,Idx[n]);

in zorro 1.744

Edited by oligodar (01/14/18 20:24)

#470447 - 01/15/18 10:58 Re: sortIdx [Re: oligodar]
jcl Offline

Chief Engineer

Registered: 07/22/00
Posts: 26529
Loc: Frankfurt
AFAIK, sortIdx does not check the lookback period and the number of elements does not matter. Maybe you were using a very old Zorro version.


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at)