wantonman
2012-08-08 19:54:25
may it be that it may but what is an array of functions called in the gi world? lol
scientific speaking XDIMENTIONALARRAY? haha
scientific speaking XDIMENTIONALARRAY? haha
2012-08-08 19:54:25
2012-08-08 20:16:05
2012-08-08 20:40:40
{$I SRL/SRL.Simba}
Function Meh: Boolean;
begin
writeln('Meh function called');
result := True;
end;
Function Bleh: Boolean;
begin
writeln('Bleh function called');
Result := Meh;
end;
Function Foo: Boolean;
begin
writeln('Foo function called');
Result := False;
end;
var
I: Integer;
Parameters: TVariantArray;
ArrayOfFuncs: TStringArray;
ArrayOfResult: TVariantArray;
begin
ArrayOfFuncs := ['Foo', 'Bleh', 'Meh'];
SetLength(ArrayOfResult, Length(ArrayOfFuncs));
For I := 0 To High(ArrayOfFuncs) Do
begin
ArrayOfResult[I] := CallProc(ArrayOfFuncs[I], Parameters);
end;
end.
2012-08-08 20:54:47
2012-08-09 06:26:59
type TFunc = function (x,y: integer):integer;
type TFuncArray = array of TFunc;
function Plus(x,y: integer): integer;
begin
result:=x+y;
end;
function minus(x,y: integer): integer;
begin
result:=x-y;
end;
var
f: TFuncArray;
res:integer;
i: integer;
x,y: integer;
begin
SetLength(f,2);
x:=9;
y:=5;
F[0]:=@plus;
F[1]:=@minus;
for I:=0 to 1 do
begin
res:= f[i](x,y);
WriteLn(ToStr(res));
end;
end.
Compiled successfully in 15 ms.
14
4
Successfully executed.