Reinvent The Wheel

Round is nice, but we can do better!

Lua4Delphi

Lua4Delphi

WERE YOU REDIRECTED HERE? The Official Lua4Delphi website is currently under development. This page serves as a temporary location from which you can find out more information on the project, and what it can do for you!

This page is to serve as a short description of Lua4Delphi and its features. You can read the incredibly long details on this blog post.

THIS PROJECT IS NOT RELATED TO THE ABANDONED ONE ON SOURCEFORGE!


Download Lua4Delphi

Full release details (including SVN URL and credentials) can be found in this article.

Lua4Delphi Implementation Examples

The best way to understand what Lua4Delphi is, how it works, and what it can do for you is simply to take a look at some Implementation Examples.

Part 1 – Registering Globals, Reading Globals, Registering and calling Delphi methods from Lua.

This page is due to be removed…

The official Lua4Delphi website is in development, and (once launched) this page will be removed.

Delphi 2010 CompatibleEmbarcadero Technology Partner

35 Comments

  1. pretty good news~

  2. Pingback: Lua4Delphi Fundraiser | Reinvent The Wheel

  3. Right now we are using another project for our need of scripting inside a in memory DB.

    We would like to try to test this Lua4Delphi projects, regarding its performances.

    Is it possible?

    • I can make this available to you quite soon. Right now I’m doing wrapper unit generation passes, testing them, tweaking the code model and regenerating. The reason for this level of “attention to detail” is that producing the best code model to register Delphi Types with Lua is actually very difficult (a lot more than I ever considered back when I began this project).

      I am remarkably close to being able to provide a pre-release “working copy” to those whom donated during the fundraiser, and at this time I’ll happily provide a pre-release copy for your company to play with! I know you’ll be impressed, even without the Professional version’s automated tools to drastically speed up and simplify integration!

      With version 1 (which I won’t release because it was frighteningly difficult to integrate into your own applications) I managed to make property value retrieval and assignment so fast the profiling tool could not even measure it (it just provided its minimum value of 1ns for even a loop of 100 operations). This same degree of performance (most likely even improved further) will be seen in Version 2.
      The performance of String Parsing Operations in Lua absolutely defeats that of Delphi-compiled applications themselves, so much so that comparing the two is like comparing apples and oranges: they are worlds apart!

      I’ve added your e-mail address to my list of test requests, and I’ll e-mail you with a copy as soon as I’m ready to make it available!

      • I’d like to get a version 2 also, even the pre-released version in order to test it with delphi 2010 and soon for XE. Tell you a few of my plans, I’m made a framework using lua for VoIP application (FreeSwith proyect, google it); but now I’d to compile my framework into a Dll or something like that in order to spread the framework. Your proyect sounds to interesting.

        Regards
        Arturo Monroy

        • If you’ve already got your Lua bindings in place, you can easily make it into a DLL… just remember to export a Lua-compliant cdecl function called “luaopen_” (replace “” with the filename you give to the DLL. Add an aliased export with the name “luaopen” to the same function.

          Bingo! When you call require(“mylib”) from Lua, it’ll mount your DLL and execute that luaopen_ function, in which you provide the initial code to register your bindings :)

  4. Thank you really much. If I would find out about the project before I would for sure try to push my boss to get into the foundraiser. But unluckily I just found it.

    Right now we are using another product that is quite impressive too: it is a in memory compiler to ASM, but it is not open source and i’m feeling we will have problems in the future to find support for it if the company will close. Being a one-man-company it is a probable future for it.

    Thank you really much!

  5. I can’t find download .

  6. Thanks for Simon Stuart. Let’s Look forward to it.

  7. what time we can use lua4delphi?

  8. Great,thanks for Simon Stuart.

  9. hey! Simon! dont overwork your self!! im counting on it BUT i dont want to have you on my conscience… Family first, then work!

    • No such thing as “overwork” when you’re doing something you love :)

      • whats the estimated time till release??

        • Set the date as February 1st, at whatever state of completion it is at on that date…. reason being is that it is essentially functional enough at this point for people to start using.

          • thats wayy to long for me… need to stick to lua5.1 delphi wrapper…

          • What functionality do you require specifically? Just passing values between Lua and Delphi, calling Delphi functions from Lua, and Lua functions from Delphi? Or do you require the full Class Wrappers to expose entire Delphi objects to Lua?

          • I start with Dennis D. Spreen (http://www.spreendigital.de/blog) TLua wrapper to Lua5.1 ) : I can’t wait february for my work.

            I’m using Lua in multi (delphi) threads and I’m developping synchronization between them (based on TSemaphore, TMutex, TEvent, … objects)

            I’m interrested to port them to lua4delphi if they is a svn (git, mercurial or other) repository for collaborative work

  10. Simon will Lua4Delphi 2 support Interfaces and DLL loading and linking inside lua scripts?

    • You can use the “Alien” module for Lua, which allows you to load/link DLLs from your Lua scripts…. or you can link the DLLs from your Delphi app and expose their methods to Lua.

      • Excellent, And what about Interfaces (IInterface or IDispatch and descendants) types?
        Will this be supported in the future?

        • That depends what you mean, exactly…

          Remember: Interfaces don’t have an Implementation! They’re just a prototype to be used within a Class. Since those classes themselves can be registered with Lua, you’re already able to use the implemented form of those Interfaces.

          What I am adding at the moment is the ability to explicitly append the methods defined by an Interface to a qualifying Object Instance’ metatable… this should then meet even the most complex usage scenario for Interfaces from Lua ;)

          • Seems quite interesting.

            Wel i was thinking when working with a modular appliction and you have DLLs, then you will want to manage an api to do some work.

            This could be also usefull when working with dlls that are not made in delphi and that erturn interfaces.

            For example in the script (pascal)

            var IGIS: IGIS_Api {interface}
            IGIS_layer: IGIS_Layer;
            begin
            {start pseudocode}
            1) load the dll that contains a GIS Api.
            2)/bind the method GetGisApi method to the one existing in the dll. GetGisApi resturn an interface for TGIS_API

            {end pseudocode}

            IGIS := GetGisApi; {returns an instance created inside the dll}

            IGIS_Layer := IGIS.GetLayer(‘MyLayer’);
            IGIS.DoSomething;

            end;

            Maybe not for now, but its a powerfull feature that some time could be included. Most of the delphi scripter I have seen (PaxScript, PaxCompiler, TMS Scripter Stuido).

            I use TMS Scripter studio, not the most powerfull or faster, but it has a way to use interfaces inside the scripts. Obviously all the Interfaces should be inherited form IDispatch and all classes that you want to use in your scripts as interfaces should implement a TObjectDispatch or inherited from it, and use the {$METHODINFO ON} and {$METHODINFO OFF} before and after the class declaration.

            Don’t know exactly what is the function of {$METHODINFO ON} and {$METHODINFO OFF}, I’m an ignorant, but it is also used when wanted to work with JavaScript and the TWebBrowser and link methods and classes to and from Delphi.

            I don’t declare/define the interfaces and their respective classes in the scripts, they are declared at the program side and consumed in the script.

            Should be a good feature to add later :)

            Just wanted to give my two cents ;)

            Keep doing the nice job you’re doing.

  11. Any new on a release date? I’m eager to start using this ;-) .

  12. Pingback: /*Prog*/ Delphi-Neftalí /*finProg*/ » Una quincena más… (08/02/2012)

Leave a Reply

Required fields are marked *.

*


*