title: Delphi - Invoke Record method per name
body: <p>I wrote a scriptlanguage for my applications and my goal is to make it possible to publish any type from delphi in the script. I use rtti to automatize this task. For any instance type like classes I use the following code to find and call a method from script.  </p>
  
  <pre><code>var  Info : TRttiType;  
       Meth : TRttiMethod;  
       Param : TArray&lt;TValue&gt;;  
       Result : TValue;  
       AnyClass : TClass;   
  begin  
    ...  
    Info := RttiContext.GetType(AnyClass);  
    Meth := Info.GetMethod('AMethod');  
    Setlength(Param, 1);  
    Param[0] := TValue.From&lt;Integer&gt;(11);  
    Result := Meth.Invoke(ClassInstance, Param);  
    ...  
  end;  
  </code></pre>
  
  <p>But with a record this code doesn't work, because the TRttiMethod type doesn't offer an Invoke() method for record types. I can access the method infos by Info.GetMethod('AMethod') from the record type.<br>
  For example i have a record like this:  </p>
  
  <pre><code>TRecordType = record  
    Field1, Field2 : single;  
    procedure Calc(Value : integer);   
  end;  
  </code></pre>
  
  <p>So does anyone know a way to invoke a method from a record if i have methodname or methodaddress?</p>