## Pascal samples. Script-defined callback functions.

>     uses Classes;

>     function Compare(Item1, Item2: Pointer): Integer; register;
>     begin
>       if Integer(Item1) > Integer(Item2) then
>         result := 1
>       else if Integer(Item1) < Integer(Item2) then
>         result := -1
>       else
>        result := 0;
>     end;

>     var
>       L: TList;
>       I: Integer;
>     begin
>       L := TList.Create;
>       L.Add(Pointer(3));
>       L.Add(Pointer(1));
>       L.Add(Pointer(2));
>       L.Add(Pointer(6));
>       L.Add(Pointer(4));
>       L.Add(Pointer(5));
>       L.Sort(@Compare);
>       for I:=0 to L.Count - 1 do
>         writeln(Integer(L[I]));
>       L.Free;
>     end.

Copyright © 2006-2008 VIRT Laboratory. All rights reserved.