Results 1 to 7 of 7

Thread: JetLua - Delphi Lua SDK

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    @JernejL:

    Good news, I got the interface routines down to the now probably the minimum that I can:

    Code:
      { IJetLuaContext }
      IJetLuaContext = interface
        ['{6AEC306C-45BC-4C65-A0E1-044739DED1EB}']
    
    
        function  PushCount: Integer;
        procedure ClearStack;
        procedure PopStack(aCount: Integer);
        function  GetStackType(aIndex: Integer): TLuaType;
    
    
        function  GetValue(aType: TJetLuaValueType; aIndex: Integer): TJetLuaValue;
        procedure PushValue(aValue: TJetLuaValue);
    
    
        procedure SetTableFieldValue(aName: PChar; aValue: TJetLuaValue; aIndex: Integer);
        function  GetTableFieldValue(aName: PChar; aType: TJetLuaValueType; aIndex: Integer): TJetLuaValue;
      end;
    
    
      { TLuaFunction }
      TJetLuaFunction = procedure(aLua: IJetLuaContext) of object;
    
    
      { IJetLua }
      IJetLua = interface
        ['{671FAB20-00F2-4C81-96A6-6F675A37D00B}']
    
    
        procedure Reset;
    
    
        procedure LoadFile(aFilename: PChar; aAutoRun: Boolean = True);
        procedure LoadString(aData: PChar; aAutoRun: Boolean = True);
        procedure LoadBuffer(aData: Pointer; aSize: NativeUInt; aAutoRun: Boolean = True);
    
    
        procedure Run;
    
    
        function  RoutineExist(aName: PChar): Boolean;
        function  Call(aName: PChar; const aParams: array of TJetLuaValue): TJetLuaValue;
    
    
        function  VariableExist(aName: PChar): Boolean;
    
    
        procedure SetVariable(aName: PChar; aValue: TJetLuaValue);
        function  GetVariable(aName: PChar; aType: TJetLuaValueType): TJetLuaValue;
    
    
        procedure RegisterRoutine(aName: PChar; aRoutine: TJetLuaFunction);
    
    
        procedure RegisterRoutines(aClass: TClass); overload;
        procedure RegisterRoutines(aObject: TObject); overload;
        procedure RegisterRoutines(aTables: PChar; aClass: TClass; aTableName: PChar=nil); overload;
        procedure RegisterRoutines(aTables: PChar; aObject: TObject; aTableName: PChar=nil); overload;
    
    
        procedure AddVerInfo(aValue: Boolean);
        procedure SetNoConsole(aValue: Boolean);
        procedure SetVerInfo(aCompanyName: PChar; aFileVersion: PChar;
          aFileDescription: PChar; aInternalName: PChar; aLegalCopyright: PChar;
          aLegalTrademarks: PChar; aOriginalFilename: PChar; aProductName: PChar;
          aProductVersion: PChar; aComments: PChar);
        procedure SetExeFilename(aFilename: PChar);
        procedure SetIconFilename(aFilename: PChar);
        procedure EnableRuntimeThemes(aValue: Boolean);
        procedure EnableHighDPIAware(aValue: Boolean);
    
    
        procedure Compile(aSourceFilename: PChar; aPayloadFilename: PChar);
    
    
        function  HasPayload: Boolean;
        procedure RunPayload;
      end;
    Bad news:
    I did some initial tests and in it's present form, it will not work with freepascal, sigh. It's currently taking advantage of a lot of Delphi'ish features. Hopefully at some point I can get it working with freepascal.

  2. #2

  3. #3
    @JernejL

    I added this new routine that allows Lua function registration in freepascal:

    Code:
    procedure IJetLua.RegisterRoutine(aName: PChar; aData: Pointer; aCode: Pointer);
    So far so good. I will have to do more testing. The IJetLua.RegisterRoutines methods (the ones that take TClass and TObject params) take advantage of Delphi's extended RTTI to scan and find the JetLua function signatures for auto registration. With the added routine above, it now should be possible to implement auto registration in freepascal. Scan for the routines and call the above routine to register them. Does freepascal have extended RTTI like Delphi?
    Last edited by drezgames; 16-08-2020 at 02:05 PM.

  4. #4
    I know it has some RTTI, but i rarely dealt with that, it's question more suitable for lazarus forums.
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •