ldmud-3.2.9/doc/
ldmud-3.2.9/doc/efun/
ldmud-3.2.9/mud/
ldmud-3.2.9/mud/heaven7/
ldmud-3.2.9/mud/heaven7/lib/
ldmud-3.2.9/mud/lp-245/
ldmud-3.2.9/mud/lp-245/banish/
ldmud-3.2.9/mud/lp-245/doc/
ldmud-3.2.9/mud/lp-245/doc/examples/
ldmud-3.2.9/mud/lp-245/doc/sefun/
ldmud-3.2.9/mud/lp-245/log/
ldmud-3.2.9/mud/lp-245/obj/Go/
ldmud-3.2.9/mud/lp-245/players/lars/
ldmud-3.2.9/mud/lp-245/room/death/
ldmud-3.2.9/mud/lp-245/room/maze1/
ldmud-3.2.9/mud/lp-245/room/sub/
ldmud-3.2.9/mud/lp-245/secure/
ldmud-3.2.9/mud/morgengrauen/
ldmud-3.2.9/mud/morgengrauen/lib/
ldmud-3.2.9/mud/sticklib/
ldmud-3.2.9/mud/sticklib/src/
ldmud-3.2.9/mudlib/uni-crasher/
ldmud-3.2.9/pkg/
ldmud-3.2.9/pkg/debugger/
ldmud-3.2.9/pkg/diff/
ldmud-3.2.9/pkg/misc/
ldmud-3.2.9/src/autoconf/
ldmud-3.2.9/src/bugs/
ldmud-3.2.9/src/bugs/MudCompress/
ldmud-3.2.9/src/bugs/b-020916-files/
ldmud-3.2.9/src/bugs/doomdark/
ldmud-3.2.9/src/bugs/ferrycode/ferry/
ldmud-3.2.9/src/bugs/ferrycode/obj/
ldmud-3.2.9/src/bugs/psql/
ldmud-3.2.9/src/done/
ldmud-3.2.9/src/done/order_alist/
ldmud-3.2.9/src/done/order_alist/obj/
ldmud-3.2.9/src/done/order_alist/room/
ldmud-3.2.9/src/gcc/
ldmud-3.2.9/src/gcc/2.7.0/
ldmud-3.2.9/src/gcc/2.7.1/
ldmud-3.2.9/src/hosts/
ldmud-3.2.9/src/hosts/GnuWin32/
ldmud-3.2.9/src/hosts/amiga/NetIncl/
ldmud-3.2.9/src/hosts/amiga/NetIncl/netinet/
ldmud-3.2.9/src/hosts/amiga/NetIncl/sys/
ldmud-3.2.9/src/hosts/i386/
ldmud-3.2.9/src/hosts/msdos/byacc/
ldmud-3.2.9/src/hosts/msdos/doc/
ldmud-3.2.9/src/hosts/os2/
ldmud-3.2.9/src/hosts/win32/
ldmud-3.2.9/src/util/
ldmud-3.2.9/src/util/erq/
ldmud-3.2.9/src/util/indent/hosts/next/
ldmud-3.2.9/src/util/xerq/
ldmud-3.2.9/src/util/xerq/lpc/
ldmud-3.2.9/src/util/xerq/lpc/www/
SYNOPSIS
        mixed *sort_array(mixed *arr, string wrong_order)
        mixed *sort_array(mixed *arr, string wrong_order, object|string ob)
        mixed *sort_array(mixed *arr, string wrong_order, object|string ob
                         , mixed extra...)
        mixed *sort_array(mixed *arr, closure cl)
        mixed *sort_array(mixed *arr, closure cl, mixed extra...)

DESCRIPTION
        Create a shallow copy of the array <arr> and sort the copy
        either by the ordering function ob->wrong_order(a, b), or by
        the closure expression 'cl'.
        The sorted copy is returned as result.

        If the 'arr' argument equals 0, the result is also 0.

        'ob' is the object in which the ordering function is called
        and may be given as object or by its filename.         If <ob> is omitted,
        or neither a string nor an object, it defaults to this_object().


        The elements from the array to be sorted are passed in pairs to
        the function 'wrong_order' as arguments, followed by the <extra>
        arguments if any.

        The function should return a positive number if the elements
        are in the wrong order. It should return 0 or a negative
        number if the elements are in the correct order.

EXAMPLES
        To sort an array

          arr = ({ 3, 8, 1, 3 })

        in ascending order with the help of the ordering function

          int is_greater (int a, int b) {
            return a > b;
          }

        the following uses of sort_array() are equivalent:

          sort_array(arr, "is_greater", this_object())
          sort_array(arr, "is_greater")
          sort_array(arr, #'is_greater)
          sort_array(arr, #'>)  (this is the preferred variant :-)
          sort_array(arr, lambda(({'a, 'b}), ({#'>, 'a, 'b})))

        A more complicated example is to sort the array

          arr = ({ ({ "foo", 3 }), ({ "quux", 1 }), ... })

        in ascending order by the second element of each subarray.
        For this, the ordering function should be like

          int is_greater (mixed *a, mixed *b) {
            return a[1] > b[1];
          }

HISTORY
        LDMud 3.2.8 added the support of extra arguments.

SEE ALSO
        transpose_array(E), filter(E), map(E), alists(LPC)