Issues

Select view

Select search mode

 

improve StructSort() to accept a comparer UDF

Fixed

Description

StructSort() has a horrible function interface. it can be greatly improved by adding the option to pass a comparer UDF as an arg.

IMO the new implementation should then return an ordered struct, rather than an array.

Details

Assignee

Reporter

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Fix versions

Priority

Created 8 February 2015 at 17:59
Updated 21 March 2025 at 11:56
Resolved 21 March 2025 at 11:56

Activity

Show:

Pothys - MitrahSoft21 March 2025 at 11:56

I've reviewed this ticket, and StructSort() now accepts a comparer UDF. Lucee handles the callback function more efficiently by its key, so I will close this ticket.

Pothys - MitrahSoft24 February 2025 at 12:54
Edited

, I have tested this ticket with Lucee version 6.2.1.30-SNAPSHOT. When I tried to sort the structure using the StructSort() function with a callback function, it returned an array sorted by the keys. In ACF, it returns an array sorted by the values.
Here is the code,

Zac Spitzer21 February 2025 at 14:21
Edited

alas the callback signature for structToSorted is different, StructSort only accepts key1 & key2

your idea about an improved approach is solved by

Zac Spitzer27 January 2023 at 19:54

Zac Spitzer27 January 2023 at 19:33
Edited

Flag notifications