Sort bug

Neville Smythe neville.smythe at
Thu Aug 31 00:11:56 EDT 2023

There is a bug in sorting a container using a function, as in

sort lines tVariable by myVal(each)

where the function is for example

function myVal pStr
    return item 1 of pStr + item 2 of pStr
end myval

If the function myVal encounters a run-time error (in the example if one of the items is not a number) the sort command fails silently: the script exits at that code line and the user is unaware that the sort (and the rest of the handler) were not executed.

If you sort directly with

sort lines tVariable by (item 1 of pStr + item 2 of pStr)

the handler will throw an error dialog, as expected.

QC has confirmed this is a bug ( bug 24321 <> ) that evidently has been around for a long time.

Neville Smythe

More information about the use-livecode mailing list