nielsAD / lape

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

Add "Objectify" magic method. #150

Closed ollydev closed 3 years ago

ollydev commented 3 years ago

Allows assignment of non-object methods to object method callbacks.

function Test: String;
begin
  Result := 'Hello world';
end;

var
  Callback: function: String of object;

begin
  Callback := @Test;

  WriteLn Callback(); // Hello world
end;