Reverse sample

Feature requests for future versions of Hollywood can be voiced here
Post Reply
sinisrus
Posts: 347
Joined: Tue Apr 21, 2015 5:43 pm

Reverse sample

Post by sinisrus »

Hello,

Did you plan to do a function for reverse sample ?
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Reverse sample

Post by airsoftsoftwair »

Wouldn't be very difficult to do but I doubt that many people need such a feature. You can do this on your own: Get the sample data using GetSampleData(), reverse the data in the table, and then convert it back into a sample using CreateSample(). Voila. It's just a few lines of code.
sinisrus
Posts: 347
Joined: Tue Apr 21, 2015 5:43 pm

Re: Reverse sample

Post by sinisrus »

OK Thank you
sinisrus
Posts: 347
Joined: Tue Apr 21, 2015 5:43 pm

Re: Reverse sample

Post by sinisrus »

I use :
SORT(Table,Function(a,b) Return(a>b) EndFunction)
for reverse order => The values of the items no longer appear the same
sinisrus
Posts: 347
Joined: Tue Apr 21, 2015 5:43 pm

Re: Reverse sample

Post by sinisrus »

Ok i solved:

Code: Select all

Function ReverseItems(T)

    local i, j = 0, ListItems(T)-1

    While i < j
        T[i], T[j] = T[j], T[i]
        i = i + 1
        j = j - 1
    Wend

EndFunction
Post Reply