nielsAD / lape

Scripting engine with Pascal-like syntax for FPC and Delphi
119 stars 28 forks source link

Array helpers #178

Closed ollydev closed 2 years ago

ollydev commented 2 years ago

Lape has entered the modern ages.

Functions are generated on demand, and in typical Lape fashion can be overriden.

function <Array>.Low: Integer;
function <Array>.High: Integer;
function <Array>.Contains(Value: <ArrayType>): Boolean;
function <Array>.Remove(Value: <ArrayType>): Boolean;
procedure <Array>.Delete(Index, Count: Integer);
procedure <Array>.Delete(Index: Integer; Count: Integer = High(Integer));
procedure <Array>.Insert(Item: <ArrayType>; Index: Integer);
procedure <Array>.Swap(FromIndex, ToIndex: Integer);
function <Array>.Unique: <Array>;
function <Array>.IndexOf(Value: <ArrayType>): Integer;
function <Array>.IndicesOf(Value: <ArrayType>): TIntegerArray;
procedure <Array>.Sort;
procedure <Array>.Sort(CompareFunc: function(constref L, R: <ArrayType>): Integer);
procedure <Array>.Sort(Weights: TIntegerArray; LowToHigh: Boolean);
function <Array>.Sorted: <Array>;
function <Array>.Sorted(CompareFunc: function(constref L, R: <ArrayType>): Integer): <Array>;
function <Array>.Sorted(Weights: TIntegerArray; LowToHigh: Boolean): <Array>;
procedure <Array>.SetLength(NewLength: Integer);
function <Array>.Length: Integer;
function <Array>.Copy: <Array>;
function <Array>.Copy(StartIndex; Count: Integer = High(Integer)): <Array>;
procedure <Array>.First: <ArrayType>;
procedure <Array>.Last: <ArrayType>;
procedure <Array>.Pop: <ArrayType>;
procedure <Array>.Pop(Index: Integer): <ArrayType>;
procedure <Array>.RandomValue: <ArrayType>;
procedure <Array>.Reverse;
function <Array>.Reversed; <Array>;
procedure <Array>.Clear;
procedure <Array>.Append(Value: <ArrayType>);
procedure <Array>.Extend(Value: <ArrayType>);