Competition #1C: Reverse order of lines of a string

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Competition #1C: Reverse order of lines of a string

Post by [-hh] » Tue Dec 10, 2013 12:13 am

..........
Last edited by [-hh] on Wed Aug 13, 2014 1:37 pm, edited 2 times in total.
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Competition #1C: Reverse order of lines of a string

Post by [-hh] » Tue Dec 10, 2013 3:44 pm

..........
Last edited by [-hh] on Wed Aug 13, 2014 1:36 pm, edited 1 time in total.
shiftLock happens

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Competition #1C: Reverse order of lines of a string

Post by bn » Sun Jan 12, 2014 12:26 pm

Hi Hermann,

in another post the reverse order of lines came up and I remembered a discussion on the use-list using sort with function brought forth by Jacque. See sort in dictionary.

obviously you would have to have 2 fields, 1 "source" and 1 "destination" to run this script

Code: Select all

local sNoLines -- index used by function inverseLines to sort

on mouseUp
   put field "source" into tData
   put 0 into sNoLines -- dont worry it will count down below 0
   sort lines of tData numeric by inverseLines()
   put tData into field "destination"
end mouseUp

 private function inverseLines
   subtract 1 from sNoLines
   return sNoLines
end inverseLines
Kind regards
Bernd

Post Reply