Comparing structure of 2 tables

Hi all,

I want to check the structure of a table to decide whether it has to be
updated. To do this I want to compare this table with another table.
I wrote this procedure:

function tform1.compare(table1,table2:ttable):boolean;
var i:integer;
begin
  if table1.fielddefs.count = table2.fielddefs.count then
    begin
      for i:=0 to table1.fielddefs.count-1 do
      begin
        if table1.fielddefs.items[i] <> table2.fielddefs.items[i] then
        begin
         result:=false;
         break;
        end;
        result:=true;
      end;
    end else result:=false;
end;

But the result is always false (-> the table structures are different) even
if the two table components point to the same physical table.
Help me, I don't know how to solve it.

Thanks in advance
Tealow