deleting line of a field causes crashes

Peter M. Brigham pmbrig at gmail.com
Sun Oct 6 12:07:31 EDT 2013


On Oct 5, 2013, at 10:06 PM, Kay C Lan wrote:

> Agree with Jacque that something is wrong.
> 
> In the meantime, as a work around, and possibly help pinpoint the culprit;
> do you really need to store the data in a field? If no one is ever going to
> look at the raw full file path a custom property would be faster:
> 
> set the prefRecentFiles of stack "AppPrefs" to lFileList --last 10 files.
> 
> You could also remove the necessity of looping through the list to remove
> duplicates by using an Array with the Key being the full path and the Data
> being 'the seconds', that way any use of a previous full file path would
> simply update it's 'seconds' which could then be used to sort your list to
> most recent at the top.

Or the reverse, where the keys are the seconds and the values are the filepaths. Then:
   put the prefRecentFiles of stack "AppPrefs" into pFileList
   put the keys of pFileList into keyList
   sort lines of keyList numeric descending
   delete line 11 to -1 of keyList
   set the keys of pFileList to keyList
   set the prefRecentFiles of stack "AppPrefs" to pFileList

So many ways to skin the cat...

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig






More information about the use-livecode mailing list