Hi Pseudemys Nelsoni,
Versuchs mal so:
Delphi-Quellcode:
...
TChannel = record
name: string;
topic: string;
end;
TChannels = array[0..4] of TChannel;
var
Channels: TChannels;
...
function ChannelIndexByName(channel: string): Integer;
var
i: integer;
begin
Result := -1;
i := low(channels);
while (i <= high(channels)) and (result = -1) do
begin
if channels[i].name = channel then
result := i;
Inc(i);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Channels[0].name := '#test';
Channels[ChannelIndexByName('#test')].topic := 'hi';
showmessage(ChannelByName('#test').topic);
end;
...
Du musst die Funktion den Index zurückgeben lassen, nicht den Record.
Greetz
alcaeus