Skip to content

Latest commit

 

History

History
31 lines (28 loc) · 700 Bytes

README.md

File metadata and controls

31 lines (28 loc) · 700 Bytes

ScriptX

Auxilia a adição de métodos e variáveis ao PascalScript

Exemplo de uso

type
  TDummy = class
  public
    [RegisterMethod]
    procedure MostraMsg(AMsg : string);
  end;

var LScript : IScriptX;
    LScriptContext : IScriptXContext;
begin
  LScript := TScriptX.Create;
  LScript.RegisterMethods(TDummy);
  LScriptContext := TScriptXContext.Create;
  LScript.SetContext(LScriptContext);
  LScriptContext.AddVariable(TScriptXVariable.New
  .SetName('LSomeString')
  .SetVariableType(vtString)
  .SetOnGetValue(
    procedure (var AValue : TValue)
    begin
      AValue := 'NOOB TEST';
    end));
  LScript.SetScript('begin MostraMsg(LSomeString); end.').Execute;
end;