Reverse sample

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

Reverse sample

Post by sinisrus » Thu Jan 05, 2017 6:49 pm

Hello,

Did you plan to do a function for reverse sample ?

User avatar
airsoftsoftwair
Posts: 2558
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: Reverse sample

Post by airsoftsoftwair » Thu Jan 05, 2017 11:25 pm

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: 233
Joined: Tue Apr 21, 2015 5:43 pm

Re: Reverse sample

Post by sinisrus » Fri Jan 06, 2017 12:44 am

OK Thank you

sinisrus
Posts: 233
Joined: Tue Apr 21, 2015 5:43 pm

Re: Reverse sample

Post by sinisrus » Sat Jan 07, 2017 11:43 am

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: 233
Joined: Tue Apr 21, 2015 5:43 pm

Re: Reverse sample

Post by sinisrus » Mon Jan 09, 2017 4:40 pm

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